Operation Triggering Method and Apparatus for Machine-To-Machine Communications

ABSTRACT

The present invention provides an operation triggering method and apparatus for machine-to-machine communications. The method implemented in a service capability middleware, includes retrieving a change result of the content of the subject resource stored in the service capability middleware; retrieving a representation of the operation resource associated with the subject resource, where the representation of the operation resource includes a condition for sending an operation request to an object resource and a uniform resource identifier of the object resource; constructing the operation request for the object resource when it is determined that the change result meets the condition for sending the operation request to the object resource in the representation of the operation resource; and sending the operation request to the object resource.

This application is a continuation of International Application No.PCT/CN2013/071704, filed on Feb. 20, 2013, which application is herebyincorporated herein by reference.

TECHNICAL FIELD

The present invention relates to the computer field, and in particular,to an operation triggering method and apparatus for machine-to-machinecommunications.

BACKGROUND

Machine-to-machine communications (M2M for short hereinafter) is anetworked application and service centering on intelligentmachine-to-machine interaction. By embedding a wireless or wiredcommunications module and application processing logic in a machine, theM2M implements data communication without manual intervention, so as tomeet information requirements of users in aspects of monitoring,commanding and scheduling, data collection and measurement, and thelike. In a conventional typical M2M application network architecture,various M2M terminals (such as a sensor and a microcontroller) access anM2M service platform directly or remotely by using an M2M gateway, whilevarious M2M applications (such as electricity meter reading andintelligent traffic) retrieve, with a service capability provided by theM2M service platform, data collected by the M2M terminals, or performremote control and management on the M2M terminals.

The European Telecommunications Standards Institute (ETSI for shorthereinafter) M2M uses a RESTful architecture. REST, an acronym forRepresentational State Transfer, means “representational statetransfer”. If an architecture is based on REST, the architecture isreferred to as a RESTful architecture. Its characteristic is thateverything is made up of resources, where a resource is a text segmentexisting in a network or is in multiple other media forms. Each resourcehas a unique uniform resource identifier (URI for short hereinafter). Anapplication program or service capability middleware may access theresource by using the URI. Each resource is accessed in fixed manners,including manners such as create, update, delete, and retrieve. Inaddition, in the RESTful architecture, a client and a server are bothstateless.

In an M2M system, the following scenario exists extensively: When astatus of a device changes, another device or multiple devices mayperform a single operation or a series of operations according towhether the change meets a condition. The action of foregoing operationtriggering is implemented by an application program installed on aspecific device (such as a device that directly performs theoperations). However, in some restricted environments, the device needsto go to sleep periodically, and the application program is interruptedas the device goes to sleep; consequently, operations between resourcescannot be triggered. In some scenarios in which the device needs to beoffline and used outdoors, a service of the application program isinterrupted as the device is offline. Therefore, in the M2M system,operation triggering by using the application program suffers from adisadvantage of poor stability.

SUMMARY

Embodiments of the present invention provide an operation triggeringmethod and apparatus for machine-to-machine communications to improvestability of operation triggering in an M2M system.

A first aspect of the present invention provides an operation triggeringmethod for machine-to-machine communications, where service capabilitymiddleware stores a representation of a subject resource, where therepresentation of the subject resource includes content of the subjectresource and information about an operation resource associated with thesubject resource, and the method includes: when the content of thesubject resource is changed, retrieving, by the service capabilitymiddleware, a change result of the content of the subject resourcestored in the service capability middleware; retrieving, by the servicecapability middleware according to the information about the operationresource associated with the subject resource, a representation of theoperation resource associated with the subject resource, where therepresentation of the operation resource includes a condition forsending an operation request to an object resource and a uniformresource identifier of the object resource; constructing the operationrequest for the object resource when the service capability middlewaredetermines that the change result meets the condition for sending theoperation request to the object resource in the representation of theoperation resource; and sending, by the service capability middleware,the operation request to the object resource according to the uniformresource identifier of the object resource.

With reference to the first aspect of the present invention, in a firstpossible implementation manner, the information about the operationresource associated with the subject resource is the representation ofthe operation resource associated with the subject resource, and theretrieving, by the service capability middleware according to theinformation about the operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource, includes: retrieving, by the service capabilitymiddleware according to the representation, included in therepresentation of the subject resource, of the operation resourceassociated with the subject resource, the representation of theoperation resource associated with the subject resource; or theinformation about the operation resource associated with the subjectresource is a uniform resource identifier of the operation resourceassociated with the subject resource, and the retrieving, by the servicecapability middleware according to the information about the operationresource associated with the subject resource, a representation of theoperation resource associated with the subject resource, includes:retrieving, by the service capability middleware according to theuniform resource identifier of the operation resource included in therepresentation of the subject resource, the representation of theoperation resource associated with the subject resource; or theinformation about the operation resource associated with the subjectresource is a uniform resource identifier of an operation resource setto which the operation resource associated with the subject resourcebelongs, and the retrieving, by the service capability middlewareaccording to the information about the operation resource associatedwith the subject resource, a representation of the operation resourceassociated with the subject resource, includes: retrieving, by theservice capability middleware according to the uniform resourceidentifier, included in the representation of the subject resource, ofthe operation resource set to which the operation resource belongs, therepresentation of the operation resource associated with the subjectresource, where the representation of the operation resource associatedwith the subject resource is a representation of an operation resourceincluded in the operation resource set.

With reference to the first aspect of the present invention or the firstpossible implementation manner, in a second possible implementationmanner, before the retrieving, by the service capability middleware, achange result of the content of the subject resource stored in theservice capability middleware, the method further includes: receiving,by the service capability middleware, a subject resource update request,where the subject resource update request includes a representation of anew subject resource and a uniform resource identifier of the subjectresource to be updated, where the representation of the new subjectresource includes information about an operation resource associatedwith the new subject resource, and updating, by the service capabilitymiddleware, the stored representation of the subject resource to therepresentation of the new subject resource according to the uniformresource identifier of the subject resource to be updated; or receiving,by the service capability middleware, an operation resource createrequest, where the operation resource create request includes therepresentation of the operation resource associated with the subjectresource and the uniform resource identifier of the operation resourceset to which the operation resource associated with the subject resourcebelongs, and adding, by the service capability middleware, therepresentation of the operation resource to the operation resource setaccording to the uniform resource identifier of the operation resourceset to which the operation resource belongs.

With reference to the first aspect or the first or second possibleimplementation manner, in a third possible implementation manner, therepresentation of the operation resource further includes a type of theoperation request and an input parameter of the operation request, wherethe type of the operation request is create or update; and when theinput parameter is a uniform resource identifier of a parameterresource, the constructing the operation request for the object resourceincludes: retrieving, by the service capability middleware, arepresentation of a new object resource from the parameter resource thatis pointed to by the uniform resource identifier of the parameterresource, and constructing the operation request that includes theuniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource; or when theinput parameter is a representation of a new object resource, theconstructing the operation request for the object resource includes:constructing, by the service capability middleware, the operationrequest that includes the uniform resource identifier of the objectresource and the representation of the new object resource and that isfor the object resource in the representation of the operation resource.

With reference to the first aspect or any one of the first to the thirdpossible implementation manners, in a fourth possible implementationmanner, before the retrieving, by the service capability middleware, achange result of the content of the subject resource stored in theservice capability middleware, the method further includes: receiving,by the service capability middleware, an operation resource updaterequest, where the operation resource update request includes arepresentation of a new operation resource, where the representation ofthe new operation resource includes a representation of a dependencyresource or a uniform resource identifier of a dependency resource, andupdating, by the service capability middleware, the storedrepresentation of the operation resource to the representation of thenew operation resource; or receiving, by the service capabilitymiddleware, a dependency resource create request, where the dependencyresource create request includes a representation of a dependencyresource and a uniform resource identifier of a dependency resource setto which the dependency resource belongs, saving, by the servicecapability middleware, the representation of the dependency resource tothe dependency resource set according to the uniform resource identifierof the dependency resource set to which the dependency resource belongs,and adding the uniform resource identifier of the dependency resourceset to the representation of the operation resource.

With reference to the fourth possible implementation manner, in a fifthpossible implementation manner, before the constructing, by the servicecapability middleware, the operation request for the object resource,the method includes: retrieving, by the service capability middlewareaccording to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource; retrieving, by the service capability middleware, arepresentation of a condition resource that is pointed to by a uniformresource identifier in the representation of the dependency resource;and determining, by the service capability middleware according to therepresentation of the condition resource, that a condition in therepresentation of the dependency resource is met.

With reference to the fifth possible implementation manner, in a sixthpossible implementation manner, types of the dependency resource areclassified into a sufficient condition type and a necessary conditiontype, a dependency resource quantity is at least one, and before theconstructing, by the service capability middleware, the operationrequest for the object resource in the representation of the operationresource, the method further includes: determining that a conditionspecified by at least one dependency resource of the sufficientcondition type is met; or determining that conditions specified by alldependency resources of the necessary condition type are met.

With reference to the fifth possible implementation manner, in a seventhpossible implementation manner, the retrieving, by the servicecapability middleware according to the representation of the operationresource, the representation of the dependency resource associated withthe operation resource, includes: retrieving, by the service capabilitymiddleware according to the representation of the dependency resourceincluded in the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource; or retrieving, by the service capability middleware accordingto the uniform resource identifier of the dependency resource includedin the representation of the operation resource, the representation ofthe dependency resource associated with the operation resource; orretrieving, by the service capability middleware according to theuniform resource identifier, included in the representation of theoperation resource, of the dependency resource set to which thedependency resource belongs, the representation of the dependencyresource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

With reference to the first aspect or any one of the foregoing possibleimplementation manners, in an eighth possible implementation manner, itis determined that at least two operation resources are associated withthe subject resource, where representations of the operation resourcesfurther include priorities, and the constructing, by the servicecapability middleware, the operation request for the object resource inthe representation of the operation resource, includes: constructing, bythe service capability middleware, an operation request for an objectresource in the representation of each operation resource in sequenceaccording to the priorities in the representations of the operationresources.

With reference to the first aspect or any one of the foregoing possibleimplementation manners, in a ninth possible implementation manner, therepresentation of the operation resource further includes an operationexecution result, and the method further includes: receiving, by theservice capability middleware, an operation response returned by adevice that the object resource is located, and saving the operationresponse into the operation execution result in the representation ofthe operation resource; or the representation of the operation resourcefurther includes an address reflecting an operation execution result andthe operation execution result, and the method further includes:receiving, by the service capability middleware, an operation responsereturned by a device that the object resource is located, retrieving,according to the address reflecting the operation execution result, anoperation result corresponding to the operation request, and saving theoperation result corresponding to the operation request into theoperation execution result.

A second aspect of the present invention provides an operationtriggering apparatus for machine-to-machine communications, including aretrieving module, a constructing module, and a sending module, wherethe retrieving module is configured to retrieve a change result ofcontent of a subject resource stored in a service capability middlewarewhen the content of the subject resource is changed, and retrieve,according to information about an operation resource associated with thesubject resource, a representation of the operation resource associatedwith the subject resource, where the representation of the operationresource includes a condition for sending an operation request to anobject resource and a uniform resource identifier of the objectresource, where the service capability middleware stores arepresentation of the subject resource, where the representation of thesubject resource includes the content of the subject resource and theinformation about the operation resource associated with the subjectresource; the retrieving module is further configured to send the changeresult and the representation of the operation resource to theconstructing module; the constructing module is configured to receivethe change result and the representation of the operation resourceassociated with the subject resource, and when it is determined that thechange result meets the condition for sending the operation request tothe object resource in the representation of the operation resource,construct the operation request for the object resource, and send theoperation request to the sending module; and the sending module isconfigured to receive the operation request, and send the operationrequest to the object resource according to the uniform resourceidentifier of the object resource.

With reference to the second aspect of the present invention, in a firstpossible implementation manner, the information about the operationresource associated with the subject resource is the representation ofthe operation resource associated with the subject resource, and thatthe retrieving module retrieves, according to information about anoperation resource associated with the subject resource, arepresentation of the operation resource associated with the subjectresource, is specifically: retrieving, according to the representation,included in the representation of the subject resource, of the operationresource associated with the subject resource, the representation of theoperation resource associated with the subject resource; or theinformation about the operation resource associated with the subjectresource is a uniform resource identifier of the operation resourceassociated with the subject resource, and that the retrieving moduleretrieves, according to information about an operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, is specifically:retrieving, according to the uniform resource identifier of theoperation resource included in the representation of the subjectresource, the representation of the operation resource associated withthe subject resource; or the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofan operation resource set to which the operation resource associatedwith the subject resource belongs, and that the retrieving moduleretrieves, according to information about an operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, is specifically:retrieving, according to the uniform resource identifier, included inthe representation of the subject resource, of the operation resourceset to which the operation resource belongs, the representation of theoperation resource associated with the subject resource, where therepresentation of the operation resource associated with the subjectresource is a representation of an operation resource included in theoperation resource set.

With reference to the second aspect of the present invention or thefirst possible implementation manner, in a second possibleimplementation manner, the apparatus further includes a receivingmodule, where the receiving module is configured to receive a subjectresource update request before the retrieving module retrieves thechange result of the content of the subject resource stored in theapparatus, where the subject resource update request includes arepresentation of a new subject resource and a uniform resourceidentifier of the subject resource to be updated, where therepresentation of the new subject resource includes information about anoperation resource associated with the new subject resource, and thereceiving module updates the stored representation of the subjectresource to the representation of the new subject resource according tothe uniform resource identifier of the subject resource to be updated;or the receiving module is configured to receive an operation resourcecreate request before the retrieving module retrieves the change resultof the content of the subject resource stored in the apparatus, wherethe operation resource create request includes the representation of theoperation resource associated with the subject resource and the uniformresource identifier of the operation resource set to which the operationresource belongs, and the receiving module adds the representation ofthe operation resource to the operation resource set according to theuniform resource identifier of the operation resource set to which theoperation resource belongs.

With reference to the second aspect or the first or second possibleimplementation manner, in a third possible implementation manner, therepresentation of the operation resource further includes a type of theoperation request and an input parameter of the operation request, wherethe type of the operation request is create or update; and when theinput parameter is a uniform resource identifier of a parameterresource, that the constructing module constructs the operation requestfor the object resource is specifically: retrieving a representation ofa new object resource from the parameter resource that is pointed to bythe uniform resource identifier of the parameter resource, andconstructing the operation request that includes the uniform resourceidentifier of the object resource and the representation of the newobject resource and that is for the object resource in therepresentation of the operation resource; or when the input parameter isa representation of a new object resource, that the constructing moduleconstructs the operation request for the object resource isspecifically: constructing the operation request that includes theuniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource.

With reference to the second aspect or any one of the first to the thirdpossible implementation manners, in a fourth possible implementationmanner, the receiving module is further configured to receive anoperation resource update request before the retrieving module retrievesthe change result of the content of the subject resource stored in theservice capability middleware, where the operation resource updaterequest includes a representation of a new operation resource, where therepresentation of the new operation resource includes a representationof a dependency resource or a uniform resource identifier of adependency resource, and is configured to update the storedrepresentation of the operation resource to the representation of thenew operation resource; or the receiving module is further configured toreceive a dependency resource create request before the retrievingmodule retrieves the change result of the content of the subjectresource stored in the service capability middleware, where thedependency resource create request includes a representation of adependency resource and a uniform resource identifier of a dependencyresource set to which the dependency resource belongs, and is configuredto save the representation of the dependency resource to the dependencyresource set according to the uniform resource identifier of thedependency resource set to which the dependency resource belongs, andadd the uniform resource identifier of the dependency resource set tothe representation of the operation resource.

With reference to the fourth possible implementation manner, in a fifthpossible implementation manner, the apparatus may further include adetermining module, where the retrieving module is further configured toretrieve, according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, retrieve a representation of a condition resource that ispointed to by a uniform resource identifier in the representation of thedependency resource, and send the representation of the conditionresource and a condition in the representation of the dependencyresource to the determining module; and the determining module isconfigured to receive the representation of the condition resource, anddetermine, according to the representation of the condition resource,that the condition in the representation of the dependency resource ismet.

With reference to the fifth possible implementation manner, in a sixthpossible implementation manner, types of the dependency resource areclassified into a sufficient condition type and a necessary conditiontype, and a dependency resource quantity is at least one; and before theconstructing module constructs the operation request for the objectresource in the representation of the operation resource, thedetermining module is further configured to determine that a conditionspecified by at least one dependency resource of the sufficientcondition type is met; or before the constructing module constructs theoperation request for the object resource in the representation of theoperation resource, the determining module is further configured todetermine that conditions specified by all dependency resources of thenecessary condition type are met, and the service capability middlewareconstructs the operation request for the object resource in therepresentation of the operation resource.

With reference to the fifth possible implementation manner, in a seventhpossible implementation manner, that the retrieving module may furtherretrieve, according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, is specifically: retrieving, according to the representationof the dependency resource included in the representation of theoperation resource, the representation of the dependency resourceassociated with the operation resource; or retrieving, according to theuniform resource identifier of the dependency resource included in therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource; orretrieving, according to the uniform resource identifier included in therepresentation of the operation resource, of the dependency resource setto which the dependency resource belongs, the representation of thedependency resource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

With reference to the second aspect or any one of the foregoing possibleimplementation manners, in an eighth possible implementation manner, itis determined that at least two operation resources are associated withthe subject resource, that is, in the operation triggering apparatus formachine-to-machine communications, at least two operation resources areassociated with the subject resource, representations of the operationresources further include priorities, and that the constructing moduleconstructs the operation request for the object resource in therepresentation of the operation resource is specifically: constructingan operation request for an object resource in the representation ofeach operation resource in sequence according to the priorities in therepresentations of the operation resources.

With reference to the second aspect or any one of the foregoing possibleimplementation manners, in a ninth possible implementation manner, therepresentation of the operation resource further includes an operationexecution result, and the receiving module is further configured toreceive an operation response returned by the device in which the objectresource is located, and save the operation response into the operationexecution result in the representation of the operation resource; or therepresentation of the operation resource further includes an addressreflecting an operation execution result and the operation executionresult, and the receiving module is further configured to receive anoperation response returned by the device in which the object resourceis located, and the retrieving module is further configured to retrieve,according to the address reflecting the operation execution result, anoperation result corresponding to the operation request, and save theoperation result corresponding to the operation request into theoperation execution result.

A third aspect of the present invention provides another operationtriggering apparatus for machine-to-machine communications, including anetwork interface, a processor, and a memory, where: the networkinterface is configured to perform communication with an externaldevice; the memory is configured to store an application program; theprocessor is configured to: invoke the application program stored in thememory; when content of a subject resource is changed, retrieve a changeresult of the content of the subject resource stored in the servicecapability middleware, and retrieve, according to information about anoperation resource associated with the subject resource, arepresentation of the operation resource associated with the subjectresource, where the representation of the operation resource includes acondition for sending an operation request to an object resource and auniform resource identifier of the object resource; and when it isdetermined that the change result meets the condition for sending theoperation request to the object resource in the representation of theoperation resource, construct the operation request for the objectresource, where the service capability middleware stores arepresentation of the subject resource, and the representation of thesubject resource includes the content of the subject resource and theinformation about the operation resource associated with the subjectresource; and the network interface is further configured to send theoperation request to the object resource according to the uniformresource identifier of the object resource.

With reference to the third aspect of the present invention, in a firstpossible implementation manner, the information about the operationresource associated with the subject resource is the representation ofthe operation resource associated with the subject resource, and thatthe processor retrieves, according to the representation of the subjectresource, a representation of the operation resource associated with thesubject resource, is specifically: retrieving, according to therepresentation of the operation resource included in the representationof the subject resource, the representation of the operation resourceassociated with the subject resource; or the information about theoperation resource associated with the subject resource is a uniformresource identifier of the operation resource associated with thesubject resource, and that the processor retrieves, according to therepresentation of the subject resource, a representation of theoperation resource associated with the subject resource, isspecifically: retrieving, according to the uniform resource identifierof the operation resource included in the representation of the subjectresource, the representation of the operation resource associated withthe subject resource; or the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofan operation resource set to which the operation resource associatedwith the subject resource belongs, and that the processor retrieves,according to the representation of the subject resource, arepresentation of the operation resource associated with the subjectresource, is specifically: retrieving, according to the uniform resourceidentifier, included in the representation of the subject resource, ofthe operation resource set to which the operation resource belongs, therepresentation of the operation resource associated with the subjectresource, where the representation of the operation resource associatedwith the subject resource is a representation of an operation resourceincluded in the operation resource set.

With reference to the third aspect of the present invention or the firstpossible implementation manner, in a second possible implementationmanner, the network interface is further configured to receive a subjectresource update request, where the subject resource update requestincludes a representation of a new subject resource and a uniformresource identifier of the subject resource to be updated, where therepresentation of the new subject resource includes information about anoperation resource associated with the new subject resource, and theprocessor invokes the application program stored in the memory to updatethe stored representation of the subject resource to the representationof the new subject resource according to the uniform resource identifierof the subject resource to be updated; or the network interface isfurther configured to receive an operation resource create request,where the operation resource create request includes the representationof the operation resource associated with the subject resource and theuniform resource identifier of the operation resource set to which theoperation resource associated with the subject resource belongs, and theprocessor invokes the application program stored in the memory to addthe representation of the operation resource to the operation resourceset according to the uniform resource identifier of the operationresource set to which the operation resource belongs.

With reference to the third aspect or the first or second possibleimplementation manner, in a third possible implementation manner, therepresentation of the operation resource further includes a type of theoperation request and an input parameter of the operation request, wherethe type of the operation request is create or update; and when theinput parameter is a uniform resource identifier of a parameterresource, the processor retrieves a representation of a new objectresource from the parameter resource that is pointed to by the uniformresource identifier of the parameter resource, and constructs theoperation request that includes the uniform resource identifier of theobject resource and the representation of the new object resource andthat is for the object resource in the representation of the operationresource; or when the input parameter is a representation of a newobject resource, the processor constructs the operation request thatincludes the uniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource.

With reference to the third aspect or any one of the first to the thirdpossible implementation manners, in a fourth possible implementationmanner, the network interface is further configured to receive anoperation resource update request, where the operation resource updaterequest includes a representation of a new operation resource, where therepresentation of the new operation resource includes a representationof a dependency resource or a uniform resource identifier of adependency resource, and the processor invokes the application programstored in the memory to update the stored representation of theoperation resource to the representation of the new operation resource;or the network interface is further configured to receive a dependencyresource create request, where the dependency resource create requestincludes a representation of a dependency resource and a uniformresource identifier of a dependency resource set to which the dependencyresource belongs, and the processor invokes the application programstored in the memory to save the representation of the dependencyresource to the dependency resource set according to the uniformresource identifier of the dependency resource set to which thedependency resource belongs, and add the uniform resource identifier ofthe dependency resource set to the representation of the operationresource.

With reference to the fourth possible implementation manner, in a fifthpossible implementation manner, the processor further retrieves,according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, retrieves a representation of a condition resource that ispointed to by a uniform resource identifier in the representation of thedependency resource, and determines, according to the representation ofthe condition resource, that a condition in the representation of thedependency resource is met.

With reference to the fifth possible implementation manner, in a sixthpossible implementation manner, types of the dependency resource areclassified into a sufficient condition type and a necessary conditiontype, a dependency resource quantity is at least one, and beforeconstructing the operation request for the object resource in therepresentation of the operation resource, the processor furtherdetermines that a condition specified by at least one dependencyresource of the sufficient condition type is met, or determines thatconditions specified by all dependency resources of the necessarycondition type are met.

With reference to the fifth possible implementation manner, in a seventhpossible implementation manner, the processor retrieves, according tothe representation of the dependency resource included in therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource; orretrieves, according to the uniform resource identifier of thedependency resource included in the representation of the operationresource, the representation of the dependency resource associated withthe operation resource; or retrieves, according to the uniform resourceidentifier, included in the representation of the operation resource, ofthe dependency resource set to which the dependency resource belongs,the representation of the dependency resource associated with theoperation resource, where the representation of the dependency resourceassociated with the operation resource is a representation of adependency resource included in the dependency resource set.

With reference to the third aspect or any one of the foregoing possibleimplementation manners, in an eighth possible implementation manner, atleast two operation resources are associated with the subject resource,representations of the operation resources further include priorities,and the processor constructs an operation request for an object resourcein the representation of each operation resource in sequence accordingto the priorities in the representations of the operation resources.

With reference to the third aspect or any one of the foregoing possibleimplementation manners, in a ninth possible implementation manner, therepresentation of the operation resource further includes an operationexecution result, the network interface is further configured to receivean operation response returned by the device in which the objectresource is located, and the processor saves the operation response intothe operation execution result in the representation of the operationresource; or the representation of the operation resource furtherincludes an address reflecting an operation execution result and theoperation execution result, the network interface is further configuredto receive an operation response returned by the device that the objectresource is located, and the processor retrieves, according to theaddress reflecting the operation execution result, an operation resultcorresponding to the operation request, and saves the operation resultcorresponding to the operation request into the operation executionresult.

The service capability middleware in the foregoing embodiments of thepresent invention may be middleware on an M2M platform or a gateway.Both the M2M platform and the gateway are nodes having capabilities in anetwork, and therefore a problem of capability restriction does notexist, which is advantageous for handling situations in which servicescannot be performed in restricted environments. In addition, in theforegoing embodiments of the present invention, the representation ofthe operation resource associated with the subject resource can beretrieved according to the representation of the subject resource, sothat operation triggering relationships between resources may bedistributed on each node (the M2M platform or the gateway), therebyavoiding complexity of a single application program. The technicalsolutions provided by the foregoing embodiments of the present inventioncan enhance capabilities of the middleware on the M2M platform and thegateway, so that it is possible to deploy richer applications.Introduction of the operation resource makes operation triggering moreapplicable to a RESTful architecture.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solutions in the embodiments of the presentinvention more clearly, the following briefly introduces theaccompanying drawings required for describing the embodiments.Apparently, the accompanying drawings in the following description showsome embodiments of the present invention, and persons of ordinary skillin the art may still derive other drawings from these accompanyingdrawings without creative efforts.

FIG. 1 is a schematic flowchart of an operation triggering method forM2M according to an embodiment of the present invention;

FIG. 2 is a schematic diagram of a resource structure according to anembodiment of the present invention;

FIG. 3 is a schematic flowchart of an operation triggering methodaccording to a specific embodiment of the present invention;

FIG. 4 is a schematic flowchart of configuring operation triggeringaccording to an embodiment of the present invention;

FIG. 5 is architecture diagram 1 of an operation resource TurnOnACaccording to an embodiment of the present invention;

FIG. 6 is an architecture diagram of a dependency resource MemberAtHomeaccording to an embodiment of the present invention;

FIG. 7 is an architecture diagram of a system according to an embodimentof the present invention;

FIG. 8 is architecture diagram 1 of an operation resource CloseWindowaccording to an embodiment of the present invention;

FIG. 9 is a schematic diagram of an association between a subjectresource and operation resources according to an embodiment of thepresent invention;

FIG. 10 is a schematic flowchart of operation triggering according to anembodiment of the present invention;

FIG. 11 is a schematic flowchart of retrieving an input parameteraccording to an embodiment of the present invention;

FIG. 12 is architecture diagram 2 of an operation resource TurnOnACaccording to an embodiment of the present invention;

FIG. 13 is architecture diagram 2 of an operation resource CloseWindowaccording to an embodiment of the present invention;

FIG. 14 is a schematic flowchart of performing condition detectionaccording to a dependency resource according to an embodiment of thepresent invention;

FIG. 15 is a schematic flowchart of retrieving an operation resultaccording to an embodiment of the present invention;

FIG. 16 is schematic structural diagram 1 of an operation triggeringapparatus for machine-to-machine communications according to anembodiment of the present invention; and

FIG. 17 is schematic structural diagram 2 of an operation triggeringapparatus for machine-to-machine communications according to anembodiment of the present invention.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

To make the objectives, technical solutions, and advantages of theembodiments of the present invention clearer, the following clearlydescribes the technical solutions in the embodiments of the presentinvention with reference to the accompanying drawings in the embodimentsof the present invention. Apparently, the described embodiments are somebut not all of the embodiments of the present invention. All otherembodiments obtained by persons of ordinary skill in the art based onthe embodiments of the present invention without creative efforts shallfall within the protection scope of the present invention.

In view of disadvantages of a high maintenance cost and poor stabilityof the operation triggering method for M2M in the prior art, anembodiment of the present invention provides a technical solution, whereservice capability middleware stores a representation of a subjectresource, where the representation of the subject resource includescontent of the subject resource and information about an operationresource associated with the subject resource. As shown in FIG. 1, anoperation triggering method for M2M according to the embodiment of thepresent invention includes the following steps.

Step 101: When the content of the subject resource is changed, theservice capability middleware retrieves a change result of the contentof the subject resource stored in the service capability middleware.

Step 102: The service capability middleware retrieves, according to theinformation about the operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource, where the representation of the operation resourceincludes a condition for sending an operation request to an objectresource and a uniform resource identifier of the object resource.

Step 103: The service capability middleware constructs the operationrequest for the object resource when determining that the change resultmeets the condition for sending the operation request to the objectresource in the representation of the operation resource.

Step 104: The service capability middleware sends the operation requestto the object resource according to the uniform resource identifier ofthe object resource.

In the technical solution provided by the foregoing embodiment of thepresent invention, when the content of the subject resource is changed,the service capability middleware storing the change result of thecontent of the subject resource retrieves, according to the informationabout the operation resource associated with the subject resource, therepresentation of the operation resource associated with the subjectresource, constructs the operation request for the object resource inthe representation of the operation resource, and finally sends theoperation request to the object resource in the representation of theoperation resource.

The service capability middleware in the foregoing embodiment of thepresent invention may be middleware on an M2M platform or gateway. Boththe M2M platform and the gateway are nodes having capabilities in anetwork, and therefore a problem of capability restriction does notexist, which is advantageous for handling situations in which servicescannot be performed in restricted environments. In addition, in theforegoing embodiment of the present invention, the representation of theoperation resource associated with the subject resource can be retrievedaccording to the information about the operation resource associatedwith the subject resource, that is, an association is establishedbetween the subject resource and the operation resource, so thatoperation triggering relationships between resources may be distributedon each node (the M2M platform or the gateway), for example, on eachnode storing a subject resource, thereby avoiding complexity of a singleapplication program. For example, an operation of turning off an airconditioner may be used as an operation resource, while detectingwhether a master is at home and detecting an indoor temperature mayseparately exist as a subject resource. According to the embodiment ofthe present invention, the operation resource of turning off the airconditioner may be saved to service capability middleware on a gatewayto which the air conditioner belongs, while the two subject resources ofdetecting whether the host is at home and detecting the indoortemperature are separately saved to service capability middleware ondifferent gateways; by establishing an association between the subjectresources and the operation resource distributed on different platforms,an operation triggering function may also be implemented. The technicalsolution provided by the embodiment of the present invention can enhancecapabilities of the middleware on the M2M platform and the gateway, sothat it is possible to deploy richer applications. Introduction of theoperation resource makes operation triggering more applicable to aRESTful architecture.

In the foregoing embodiment of the present invention, the informationabout the operation resource associated with the subject resource is therepresentation of the operation resource associated with the subjectresource, and that the service capability middleware retrieves,according to the information about the operation resource associatedwith the subject resource, a representation of the operation resourceassociated with the subject resource in step 102, may include:retrieving, by the service capability middleware according to therepresentation, included in the representation of the subject resource,of the operation resource associated with the subject resource, therepresentation of the operation resource associated with the subjectresource; or the information about the operation resource associatedwith the subject resource is a uniform resource identifier of theoperation resource associated with the subject resource, and that theservice capability middleware retrieves, according to the informationabout the operation resource associated with the subject resource, arepresentation of the operation resource associated with the subjectresource, includes: retrieving, by the service capability middlewareaccording to the uniform resource identifier of the operation resourceincluded in the representation of the subject resource, therepresentation of the operation resource associated with the subjectresource; or the information about the operation resource associatedwith the subject resource is a uniform resource identifier of anoperation resource set to which the operation resource associated withthe subject resource belongs, and that the service capability middlewareretrieves, according to the information about the operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, includes: retrieving, bythe service capability middleware according to the uniform resourceidentifier, included in the representation of the subject resource, ofthe operation resource set to which the operation resource belongs, therepresentation of the operation resource associated with the subjectresource, where the representation of the operation resource associatedwith the subject resource is a representation of an operation resourceincluded in the operation resource set.

That is, the association between the subject resource and the operationresource may be established in three manners: the representation of thesubject resource includes the representation of the operation resource,the representation of the subject resource includes the uniform resourceidentifier of the operation resource, or the representation of thesubject resource includes the uniform resource identifier of theoperation resource set to which the operation resource belongs.

In the foregoing embodiment of the present invention, before the servicecapability middleware retrieves the change result of the content of thesubject resource stored in the service capability middleware in step101, the method further includes: receiving, by the service capabilitymiddleware, a subject resource update request, where the subjectresource update request includes a representation of a new subjectresource and a uniform resource identifier of the subject resource to beupdated, where the representation of the new subject resource includesinformation about an operation resource associated with the new subjectresource, and updating, by the service capability middleware, the storedrepresentation of the subject resource to the representation of the newsubject resource according to the uniform resource identifier of thesubject resource to be updated, where it should be noted that thesubject resource update request further includes the representation ofthe subject resource before the update in addition to the representationof the operation resource or the uniform resource identifier of theoperation resource; or receiving, by the service capability middleware,an operation resource create request, where the operation resourcecreate request includes the representation of the operation resourceassociated with the subject resource and the uniform resource identifierof the operation resource set to which the operation resource associatedwith the subject resource belongs, and adding, by the service capabilitymiddleware, the representation of the operation resource to theoperation resource set according to the uniform resource identifier ofthe operation resource set to which the operation resource belongs.

In addition, in the foregoing embodiment of the present invention, therepresentation of the operation resource may further include a type ofthe operation request, while the type of the constructed operationrequest may be any one of create, update, retrieve, and delete. When thetype of the operation request is create or update, that is, when theoperation request is used to create or update a representation of anobject resource, the create operation request further needs to carry arepresentation of a new object resource for the operation resource.Specifically, the representation of the operation resource may furtherinclude an input parameter of the operation request, where the inputparameter of the operation request may be a URI of a parameter resource,or the representation of the new object resource is directly saved inthe input parameter of the operation request.

Specifically, when the input parameter is the uniform resourceidentifier of the parameter resource, the constructing the operationrequest for the object resource includes: retrieving, by the servicecapability middleware, the representation of the new object resourcefrom the parameter resource that is pointed to by the uniform resourceidentifier of the parameter resource, and constructing the operationrequest that includes the uniform resource identifier of the objectresource and the representation of the new object resource and that isfor the object resource in the representation of the operation resource;or when the input parameter is the representation of the new objectresource, the constructing the operation request for the object resourceincludes: constructing, by the service capability middleware, theoperation request that includes the uniform resource identifier of theobject resource and the representation of the new object resource andthat is for the object resource in the representation of the operationresource.

In the foregoing embodiment of the present invention, before the servicecapability middleware retrieves the change result of the content of thesubject resource stored in the service capability middleware, the methodfurther includes: receiving, by the service capability middleware, anoperation resource update request, where the operation resource updaterequest includes a representation of a new operation resource, where therepresentation of the new operation resource includes a representationof a dependency resource or a uniform resource identifier of adependency resource, and updating, by the service capability middleware,the stored representation of the operation resource to therepresentation of the new operation resource, where it should be notedthat the operation resource update request further includes therepresentation of the operation resource before the update in additionto the representation of the dependency resource or the uniform resourceidentifier of the dependency resource; or receiving, by the servicecapability middleware, a dependency resource create request, where thedependency resource create request includes a representation of adependency resource and a uniform resource identifier of a dependencyresource set to which the dependency resource belongs, saving, by theservice capability middleware, the representation of the dependencyresource to the dependency resource set according to the uniformresource identifier of the dependency resource set to which thedependency resource belongs, and adding the uniform resource identifierof the dependency resource set to the representation of the operationresource.

In the foregoing embodiment of the present invention, when thedependency resource exists, before the service capability middlewareconstructs the operation request for the object resource in theforegoing embodiment of the present invention, the method includes:retrieving, by the service capability middleware according to therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource; retrieving,by the service capability middleware, a representation of a conditionresource that is pointed to by a uniform resource identifier in therepresentation of the dependency resource; and determining, by theservice capability middleware according to the representation of thecondition resource, that a condition in the representation of thedependency resource is met.

Specifically, types of the foregoing dependency resource may beclassified into a sufficient condition type and a necessary conditiontype, a dependency resource quantity is at least one, and before theservice capability middleware constructs the operation request for theobject resource in the representation of the operation resource, themethod further includes: determining that a condition specified by atleast one dependency resource of the sufficient condition type is met;or determining that conditions specified by all dependency resources ofthe necessary condition type are met.

That is, when further determining that the condition specified by the atleast one dependency resource of the sufficient condition type is met,the service capability middleware constructs the operation request forthe object resource in the representation of the operation resource; orwhen further determining that the conditions specified by all thedependency resources of the necessary condition type are met, theservice capability middleware constructs the operation request for theobject resource in the representation of the operation resource.

Specifically, in the foregoing embodiment, the retrieving, by theservice capability middleware according to the representation of theoperation resource, the representation of the dependency resourceassociated with the operation resource, includes: retrieving, by theservice capability middleware according to the representation of thedependency resource included in the representation of the operationresource, the representation of the dependency resource associated withthe operation resource; or retrieving, by the service capabilitymiddleware according to the uniform resource identifier of thedependency resource included in the representation of the operationresource, the representation of the dependency resource associated withthe operation resource; or retrieving, by the service capabilitymiddleware according to the uniform resource identifier, included in therepresentation of the operation resource, of the dependency resource setto which the dependency resource belongs, the representation of thedependency resource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

That is, the association between the operation resource and thedependency resource may be established in three manners: therepresentation of the operation resource includes the representation ofthe dependency resource, the representation of the operation resourceincludes the uniform resource identifier of the dependency resource, andthe representation of the operation resource includes the uniformresource identifier of the dependency resource set to which thedependency resource belongs.

In the foregoing embodiment of the present invention, it is determinedthat at least two operation resources are associated with the subjectresource, where representations of the operation resources may furtherinclude priorities, and the constructing, by the service capabilitymiddleware, the operation request for the object resource in therepresentation of the operation resource may include: constructing, bythe service capability middleware, an operation request for an objectresource in the representation of each operation resource in sequenceaccording to the priorities in the representations of the operationresources.

In the foregoing embodiment of the present invention, the representationof the operation resource may further include an operation executionresult, and the method further includes: receiving, by the servicecapability middleware, an operation response returned by the device inwhich the object resource is located, and saving the operation responseinto the operation execution result in the representation of theoperation resource; or the representation of the operation resource mayfurther include an address reflecting an operation execution result andthe operation execution result, and the method further includes:receiving, by the service capability middleware, an operation responsereturned by the device in which the object resource is located,retrieving, according to the address reflecting the operation executionresult, an operation result corresponding to the operation request, andsaving the operation result corresponding to the operation request intothe operation execution result, where specifically, the addressreflecting the operation execution result may be a URI of a resource,the corresponding resource may be accessed according to the URI, and theoperation result corresponding to the operation request is retrieved.

The operation triggering method according to the present invention ishereinafter further described in detail in a specific embodiment. FIG. 2is a schematic diagram of a resource structure according to anembodiment of the present invention. In this embodiment, a RESTfulresource element structure is extended, and multiple operation resourcesare combined to constitute an operation resource set.

A relationship between a subject resource, an operation resource, and anoperation resource set may be shown in FIG. 2, where a rectangular blockrepresents a resource, a rounded rectangular block represents anattribute, and a black solid line indicates an association relationshipbetween two resources or between a resource and an attribute. Resourcesand attributes in this embodiment represent only an exemplary divisionmanner, and there may also be different division manners according todifferent application scenarios.

The subject resource (Subject Resource) may be any type of resource in aRESTful architecture. In this embodiment, the subject resource may be aresource that causes an operation triggering event.

The operation resource set (Operations) includes one or more operationresources (Operation) where each operation resource is corresponding toone operation triggered by the subject resource. The operation resourceset is associated with the subject resource, and a manner of indicatingthe association may be that a representation of the subject resourceincludes a URI of the operation resource set.

The operation resource indicates an operation. The operation resourcemay include a series of attributes and resources. As described above, arounded rectangular block represents an attribute, that is, attributesof the operation resource are some or all of a priority (Priority), acondition (Rule), an object resource (Object Resource), a request type(Method), an input parameter (Input), an address reflecting an operationexecution result (Output URI), and the execution result (Result)Likewise, as described above, a rectangular block represents a resource,that is, a resource in the operation resource is a dependency resourceincluded in a dependency resource set (Dependencies). Specifically, thedependency resource may further include several attributes, for example,logic, URI, and/or a condition. One or more operation resources areincluded in the operation resource set, and an association with thesubject resource is generated by using the operation resource set. Thatis, if the representation of the subject resource includes the uniformresource identifier (URI) of the operation resource set, all operationresources in the operation resource set are operation resourcesassociated with the subject resource. Therefore, when the subjectresource changes, whether operations in the operation resources need tobe executed is determined for all the operation resources in theoperation resource set.

The priority (Priority) indicates a priority of the operation resource.When multiple operation resources, for example, two or more than two,are associated with the subject resource, and operations in the multipleoperation resources need to be executed, service capability middlewareexecutes the operations in the operation resources in descending orderof priority according to the priorities in representations of theoperation resources.

The condition (Rule) indicates a condition required for executing anoperation in the operation resource. When a change result of content ofthe subject resource associated with the operation resource meets thecondition defined by Rule, the operation in the operation resource isexecuted.

The object resource (Object Resource) may be specifically indicated byusing a URI of the object resource. When the change result of thecontent of the subject resource associated with the operation resourcemeets the condition defined by Rule in the representation of theoperation resource, a common operation request for the object resourceis sent to the URI of the object resource.

Method indicates a type of an operation request for the operationresource. In the RESTful architecture, generally, finite types ofoperation requests are defined. For example, for ETSI M2M, there arefour types of operation requests, namely, create (Create), retrieve(Retrieve), update (Update), and delete (Delete).

Input indicates an input parameter of the operation request for theoperation resource. In a RESTful method, operation requests of theupdate and create types need to carry the input parameter. In a createrequest, the input parameter carried in the create request is arepresentation of a new object resource, and the representation of thenew object resource carried in the create request is used to create theentire object resource. In an update request, a representation of a newobject resource carried in the update request is used to replace arepresentation of an original object resource. Specifically, a value ofthe input parameter in the operation resource may further be a URI,where the URI points to a parameter resource, and a representation ofthe parameter resource is the representation of the new object resourcethat needs to be carried in the operation request. The input parametermay also be a text segment used to directly save the representation ofthe new object resource. The input parameter is not mandatory to eachoperation resource. When the type of the operation request is delete orretrieve, because the operation request does not need to carry the inputparameter, the representation of the operation resource of this type maynot carry the input parameter.

Output URI indicates an address reflecting an operation executionresult. In some scenarios, the operation execution result needs to befed back by using a status of another resource. For example, todetermine whether a light is turned on, it is necessary to retrieve avalue of a light sensor under the light, and an address of data of thelight sensor is the address reflecting the operation execution result.The input parameter is also not mandatory to each operation resource.Representations of operation resources of some types may not include theinput parameter.

Result indicates the operation execution result. It is a text segment.In a case in which Output URI exists, that is, when the operationexecution result is reflected by a resource pointed to by Output URI, arepresentation of the resource retrieved from Output URI is saved inResult. When Output URI is not provided, an operation response that isfed back after the operation request is sent is saved in Result.

Dependencies indicate a dependency resource (Dependency) set, that is, adependency resource set. The dependency resource indicates thatexecution of the operation resource further needs to depend on adependency condition defined by a dependency resource.

Dependency indicates the dependency resource. Three attributes may besaved in the dependency resource. One is a URI, one is a condition(Rule), and the last one is logic (Logic). Specifically, the dependencyresource is used to determine whether a representation of a conditionresource pointed to by a URI in the dependency resource meets thecondition defined by Rule in a representation of the dependencyresource. Furthermore, if a parameter in Logic is AND, it indicates thatmeeting the condition defined by Rule in the representation of thedependency resource is a necessary condition for executing the sendingof the operation request; if the parameter in Logic is OR, it indicatesthat meeting the condition defined by Rule in the representation of thedependency resource is a sufficient condition for executing the sendingof the operation request.

With reference to the resource structure diagram shown in FIG. 2, anembodiment of the present invention provides a complete flowchart of anoperation triggering method. FIG. 3 is a schematic flowchart of anoperation triggering method according to a specific embodiment of thepresent invention. As shown in FIG. 3, the method includes the followingsteps.

Step 201: Configure a subject resource, so that when content of thesubject resource is changed, an operation on an object resource istriggered.

According to a service requirement of an M2M application, an applicationprogram may configure a subject resource, so that when a content of thesubject resource is changed, one or more operations are performed on oneor more object resources. A configuration method is to associate atleast one operation resource with the subject resource. Specifically,the association may be established by using an operation resource set,or multiple operation resources may be directly associated with thesubject resource, which is not limited herein in the embodiment of thepresent invention.

Specifically, for configuring the subject resource, it may be that theapplication program sends an operation resource create request to theoperation resource set associated with the subject resource, so that anoperation resource is created in the operation resource set. Theoperation resource create request defines what operation (Method) willbe performed on which object resource (Object Resource) when what change(Rule) of the subject resource occurs, an input parameter (Input) thatneeds to be carried in an operation request for the operation, andwhether a condition defined by Rule in a dependency resource needs to bemet before the operation is executed. In addition, it may also be thatthe application program sends the operation resource create request, andan entity (for example, platform middleware) that receives the operationresource create request creates the operation resource. It may furtherbe that the application program directly sends the operation resourcecreate request to middleware that stores the subject resource, and themiddleware creates the operation resource in the representation of thesubject resource. For a specific configuration process, reference may bemade to an embodiment shown in FIG. 4.

Step 202: Retrieve a change result of the content of the subjectresource.

The subject resource may be any resource stored in service capabilitymiddleware of an M2M system. Specifically, the subject resource may be aresource that causes an operation triggering event. For example, in anoperation triggering event of turning on and off an air conditionercaused by an indoor temperature change, a resource that completes indoortemperature detection is the subject resource. Specifically, the contentof the subject resource may be a text segment, a database record, or afile that is stored in the service capability middleware and has aspecific structure. The stored text segment and the like may be changedinto a data structure by means of a deserialization process. Therepresentation of the subject resource may also be a data structure thatis directly saved in a memory of the service capability middleware.

The change of the content of the subject resource may be caused by anysituation. For example, the content of the subject resource may bechanged by request sending by another application, or the content of thesubject resource is changed by a process in the service capabilitymiddleware. The service capability middleware that stores the subjectresource detects the change result of the content of the subjectresource by listening on a program of the subject resource.

Step 203: Retrieve representations of operation resources associatedwith the subject resource, and determine that the change result of thecontent of the subject resource meets conditions defined by rules in therepresentations of the operation resources.

As shown in FIG. 2, the subject resource is associated with theoperation resources by using the operation resource set.

However, in this embodiment, it may also be that the representation ofthe subject resource includes the representation of each operationresource in FIG. 2, or the URI of each operation resource in FIG. 2, orthe URI of the operation resource set to which the operation resourcesin FIG. 2 belong. The operation resource set is a resource of a set typeand includes at least one operation resource. Each operation resourceincludes a Rule attribute that defines a condition that the changeresult of the content of the subject resource associated with theoperation resource needs to meet. The service capability middlewareperforms determining, one by one according to the change result of thecontent of the subject resource, on conditions in rules of the operationresources associated with the subject resource, and finally selectsthose operation resources in which conditions in rules are met. For aspecific implementation process of step 203, reference may be made to anembodiment shown in FIG. 10.

Step 204: For the operation resources that are associated with thesubject resource and determined in the foregoing step, select anoperation resource according to priorities of the operation resources.

A priority attribute is defined in an operation resource and used toindicate a priority of the operation resource. Specifically, thepriority may be indicated in a form of a number, where a greater numberindicates a higher priority, or in other forms. Importance and asequence of the operation resources are arranged by using thepriorities.

Specifically, in step 203, it is determined that at least two operationresources are associated with the subject resource, and the changeresult of the content of the subject resource meets conditions in rulesin the operation resources. Then in this step, the service capabilitymiddleware constructs an operation request for an object resource in arepresentation of each operation resource in sequence according to thepriorities in the representations of the operation resources, so that anoperation described in each operation resource can be executed insequence.

Step 205: Determine that dependency resources associated with theoperation resource that is selected according to the priorities in step204 exist, and determine that all conditions defined by rules in theassociated dependency resources can be met.

Specifically, for the operation resource selected in step 204, it isdetermined that the dependency resources associated with the operationresource exist. Specifically, the dependency resources associated withthe operation resource may be representations of the dependencyresources included in the representation of the operation resource (thedependency resources as shown in FIG. 2), or may be an identifier oridentifiers of one or more dependency resources included in therepresentation of the operation resource or an identifier of adependency resource set included in the representation of the operationresource, which is not limited herein in the embodiment of the presentinvention.

A dependency resource includes three attributes: URI, Logic, and Rule.After it is determined that the dependency resources associated with theoperation resource exist, the determining that all conditions defined byrules in the dependency resources can be met is specifically:retrieving, according to a URI of a dependency resource, arepresentation of a condition resource indicated by the URI; determiningwhether the representation of the condition resource can meet acondition defined by Rule in the dependency resource; if therepresentation of the condition resource can meet the condition definedby Rule in the dependency resource, further checking whether a type ofthe dependency resource defined in Logic is a sufficient condition typeor a necessary condition type; if it is the necessary condition type,continuing to check whether conditions defined by rules in otherunchecked dependency resources can be met; and if it is the sufficientcondition type, step 206 is executed directly. For a specificimplementation process of this step, reference may be made to anembodiment shown in FIG. 14.

Step 206: Retrieve an input parameter of an operation request accordingto a type of the operation request in a representation of the operationresource selected in step 204, and construct the operation request.

Specifically, in this step, first, it is determined that the type of theoperation request defined by Method in the representation of theoperation resource is create (Create) or update (Update). The inputparameter of the operation request is retrieved according to a value ofInput in the operation resource. The input parameter of the operationrequest is a representation of an object resource to be created or arepresentation of an object resource to be updated. When Input includesa URI, a representation of a resource indicated by the URI needs to beretrieved by using a retrieve (Retrieve) request and used as therepresentation of the new object resource. The representation of the newobject resource may also be saved directly as the value of Input. Inthis case, the representation of the new object resource is directlyused to construct the operation request.

The operation request to be sent is constructed according to the type ofthe operation request, the object resource, and the input parameterdefined in the operation resource. For a specific implementation processof step 206, reference may be made to an embodiment shown in FIG. 11.

Step 207: Send the operation request constructed in step 206 to a URI ofan object resource, and receive an operation response returned by adevice in which the object resource is located. Specifically,interaction between platform middleware that stores the subject resourceand the device that stores the object resource may be performed by usinga standard RESTful interface.

Step 208: According to Output URI in the representation of the operationresource that is currently executed, retrieve an execution resultcorresponding to the operation request, and save it to Result.

Specifically, when the representation of the operation resource includesOutput URI, the execution result corresponding to the operation requestneeds to be retrieved from a resource indicated by Output URI. After therequest is sent in step 207, the service capability middleware thatstores the subject resource further sends a retrieve (Retrieve) requestto Output URI to retrieve a representation of the resource indicated byOutput URI, and saves the retrieved representation of the resourceindicated by Output URI into the execution result (Result) attribute inthe representation of the operation resource.

If Output URI is not provided in the representation of the operationresource, it indicates that the execution result corresponding to theoperation request does not need to be reflected by a representation ofanother resource. In this case, after step 207 is executed, theoperation response corresponding to the operation request in step 207 isreceived. Content of the operation response is saved into the executionresult (Result) in the representation of the operation resource. For aspecific implementation process of step 208, reference may be made to anembodiment shown in FIG. 15.

Step 209: Determine whether the selected resource is a last operationresource. If the selected resource is the last operation resource, thatis, if it is determined that operations of the multiple operationresources selected in step 203 have been executed, go to step 210;otherwise, return to step 204. In this step, determining whether anoperation of an operation resource is executed may be determiningwhether a corresponding operation response is received.

Step 210: End.

FIG. 4 is a schematic flowchart of configuring operation triggeringaccording to an embodiment of the present invention. In this embodiment,an operation resource is configured for a temperature value of atemperature sensor, so that turning on an air conditioner is triggeredwhen a temperature is higher than 30° C. and a family member is at home.A system architecture diagram thereof may be shown in FIG. 7.

An M2M network application (NA for short hereinafter) server registersvarious M2M applications (such as electricity meter reading andintelligent traffic) with a network service capability layer (NSCL forshort hereinafter) of an M2M service platform by using a mIa interface.The M2M service platform accesses an M2M device by using a mId interfaceto collect data, and further performs remote device management on theM2M device by using the interface. An M2M device d (M2M device) isconnected to the NSCL of the M2M service platform by using an M2Mgateway (M2M Gateway). An M2M device D (M2M device domain) is connectedto the NSCL of the M2M service platform by using the mId interface.

An M2M device D′ is a conventional device that does not comply with anETSI M2M standard. The M2M device D is a device that complies with theETSI M2M standard. The M2M device D has a service capability layer (SCLfor short hereinafter) that is defined by the ETSI M2M standard. The M2Mdevice D′ does not have the SCL defined by the ETSI M2M standard.

By using a gateway interworking proxy function (GIP for shorthereinafter), the M2M gateway interworks with the conventional M2Mdevice d and M2M device D′ in a wireless or wired communications manner(for example, ZigBee, Bluetooth, DLMS/COSEM, Zwave, BACnet, ANSI C12,and mBus). The mId interface between the M2M gateway or M2M device D andthe M2M platform generally uses wired or wireless wide area local areanetwork communication manners (for example, xDSL, HFC, satellite, GERAN,UTRAN, E-UTRAN, WLAN, and WiMAX).

A D′A1 is a temperature sensor application. The D′A1 continuously savestemperature values to a temperature (Temperature) resource in a resourcetree of a gateway service capability layer GSCL1. A URI of the subjectresource Temperature resource is http://gscl1/temperature. An NA1 is asmart home application program. The NA1 is used to create arepresentation of an operation resource associated with the temperatureresource. A D′A5 is an air conditioner application program. The D′A5controls an air conditioner by monitoring a representation value of anair condition (AirCondition) resource in a GSCL2, for example, turns onthe air conditioner when the representation value of the air conditionresource is ON, and turns off the air conditioner when therepresentation value of the air condition resource is OFF. A URI of theair condition resource is http://gscl2/airCondition.

An NA2 is a host location application program. The application programsaves location information of a host to a host location (HostLocation)resource in the NSCL. A URI of the host location resource ishttp://nscl/hostLocation.

When a representation value of the temperature resource is higher than30 degrees Celsius, the GSCL1 needs to send a request to the GSCL2 tochange the representation of the air condition resource to ON, therebyachieving an objective of turning on the air conditioner. The NA1completes this process by creating the representation of the operationresource associated with the temperature resource.

As shown in FIG. 4, the following steps are included:

Step 301: Create a representation of an operation resource.

The NA1 on the network application server constructs an operationresource for turning on an air conditioner (TurnOnAC), which is used toexpress a condition for triggering the operation of turning on an airconditioner. According to a requirement of service logic, this step maybe repeated multiple times to create representations of multipleoperation resources. An architecture of the operation resource TurnOnACis shown in FIG. 5.

Step 302: Send an operation resource create request.

After step 301, the NA1 on the network application server encapsulatesthe constructed representation of the operation resource TurnOnACaccording to a standard of a RESTful architecture on an interface, andsends it to the gateway service capability layer GSCL1, so that theGSCL1 creates the operation resource TurnOnAC in an operation resourceset associated with the temperature resource, where a URI of theoperation resource set is http://gscl1/temperature/Operations. That is,the operation resource create request carries the URI of the operationresource set and the constructed representation of the operationresource. If the operation resource set associated with the subjectresource, for example, the temperature resource, does not exist, theoperation resource create request may carry the URI of the temperatureresource or a URI of the GSCL1, and the GSCL1 creates the operationresource, for example, creates the operation resource in therepresentation of the temperature resource, or creates the operationresource elsewhere, and includes a URI of the operation resource intothe representation of the temperature resource. The embodiment of thepresent invention is described by using an example in which theoperation resource create request carries the URI of the operationresource set.

Step 303: Create the operation resource.

After receiving the operation resource create request sent by the NA1,the gateway service capability layer GSCL1 creates, in the operationresource set (Operations) associated with the temperature resource, theoperation resource TurnOnAC in the operation resource create request,that is, adds the representation of the operation resource TurnOnAC tothe operation resource set, so that the operation resource TurnOnAC andthe temperature resource are associated. After completing creating theoperation resource TurnOnAC, the gateway service capability layerreturns a create response to the NA1.

Step 304: Create a representation of a dependency resource.

According to service requirements, the NA1 begins to create dependencyresources associated with different operation resources. In thisembodiment, whether to turn on the air conditioner depends on a locationof the host, that is, a status of the host location resourceHostLocation, and the host location resource HostLocation is thedependency resource associated with the operation resource TurnOnAC.Therefore, a dependency resource MemberAtHome is created, and arepresentation of the dependency resource MemberAtHome may be used toindicate whether a member is at home. As shown in FIG. 6, in thedependency resource MemberAtHome, a value of Logic is OR, indicatingthat a type of the dependency resource is a sufficient condition type; aURI is the URI of the host location resource; a condition Rule is thatthe status of a host location is at home.

Step 305: Send a dependency resource create request.

After step 304, the NA1 encapsulates the constructed representation ofthe dependency resource MemberAtHome according to a standard of theRESTful architecture on an interface, and sends it to the gatewayservice capability layer GSCL1, so that the GSCL1 creates the dependencyresource MemberAtHome in a dependency resource set associated with theoperation resource TurnOnAC, where a URI of the dependency resource setis http://gscl1/temperature/Operations/TurnOnAC/Dependencies. That is,the dependency resource create request includes the URI of thedependency resource set. In addition, referring to step 302, thedependency resource create request may further include the URI of theoperation resource to indicate that no dependency resource or dependencyresource set exists in the operation resource, so that the GSCL1directly saves the representation of the dependency resource into theoperation resource TurnOnAC. This embodiment is described by using anexample in which the dependency resource create request carries the URIof the dependency resource set. In addition, the dependency resourcecreate (Create) request may be sent as defined in the standard.

Step 306: Create the dependency resource.

After receiving the dependency resource create request sent by the NA1,the GSCL1 adds the representation of the dependency resourceMemberAtHome in the dependency resource create request to the dependencyresource set associated with the operation resource TurnOnAC, that is,associates the dependency resource MemberAtHome with the dependencyresource set, and thereby also associates the dependency resourceMemberAtHome with the operation resource TurnOnAC. After the dependencyresource is created, a create response is returned.

On a basis of the embodiment shown in FIG. 4, when the temperature ishigher than 30 degrees Celsius, windows further need to be closed inaddition to turning on the air conditioner, that is, two operations aretriggered. The NA1 may define that a priority of closing the windows ishigher than a priority of turning on the air conditioner, that is, thewindows need to be closed before the air conditioner is turned on. Thesystem architecture in FIG. 7 further includes a controller applicationprogram D′A4 for closing windows. The D′A4 controls the windows bymonitoring a value of a Window resource in the gateway servicecapability layer GSCL2. For example, when a representation of the Windowresource is ON, the windows are opened, and when the representation ofthe Window resource is OFF, the windows are closed. A URI of the Windowresource is http://gscl2/window.

An architecture diagram of an operation resource CloseWindow for closingwindows may be shown in FIG. 8. A value of an input parameter Input ofthe operation resource CloseWindow is a URI, while an input parameter isdirectly saved in Input of the TurnOnAC. Output URI of the operationresource CloseWindow is http://gscl2/allWindowStatus, that is, a URI ofan allWindowStatus resource. A representation of the allWindowStatusresource is used to indicate a closing status of windows in a house. ONindicates that a window is opened. OFF indicates that all the windowsare closed.

The operation resource CloseWindow and the operation resource TurnOnACare separately associated with the subject resource Temperature. Aschematic diagram of a specific association may be shown in FIG. 9.

When the representation of the temperature resource is higher than 30degrees, the two operations of the operation resource TurnOnAC andoperation resource CloseWindow are triggered. In this embodiment, thetemperature resource Temperature is saved in the gateway servicecapability layer GSCL1, and both the operation resource TurnOnAC andoperation resource CloseWindow are saved in the gateway servicecapability layer GSCL2. A specific process thereof includes steps shownin FIG. 10.

Step 401: The GSCL1 retrieves a change result of content of thetemperature resource.

Specifically, the temperature resource Temperature is used as a subjectresource, and the content of the temperature resource is changed. Thechange result of the content retrieved by the GSCL1 is 31 degrees.

Step 402: The GSCL1 determines operation resources associated with thetemperature resource Temperature.

Specifically, an association manner in this embodiment may be that therepresentation of the temperature resource includes a URI of anoperation resource set to which the operation resource TurnOnAC andoperation resource CloseWindow belong. In this embodiment, anarchitecture diagram of the temperature resource may be shown in FIG. 9.In this step, the determined operation resources associated with thetemperature resource are TurnOnAC and CloseWindow.

Step 403: Determine that the change result of the content of thetemperature resource meets conditions defined by rules inrepresentations of the operation resources TurnOnAC and CloseWindowdetermined in step 402. Rule defines a method for matchingrepresentations of resources. In ETSI M2M, Rule is a filterCriteriaattribute defined by the ETSI M2M standard. In this embodiment, theconditions defined by the rules in the representations of the TurnOnACand CloseWindow are >30° C., and the representation of the temperatureresource is changed to 31° C. Therefore, the conditions defined by therules in the TurnOnAC and CloseWindow are both met, and the twooperation resources are selected in this step. In subsequent steps,corresponding operations are executed on the selected operationresources one by one.

Step 404: Both the representations of the two operation resourcesinclude priorities (Priority) of the operation resources. In thisembodiment, the priority of the operation resource CloseWindow is 2, andthe priority of the operation resource TurnOnAC is 1. Therefore, thepriority of the operation resource CloseWindow is higher than thepriority of the operation resource TurnOnAC. Therefore, in this step,choose to execute the operation corresponding to the operation resourceCloseWindow of the higher priority first.

Step 405: Determine that a condition defined by Rule in a dependencyresource associated with the operation resource CloseWindow is met. Fordetailed steps, reference may be made to an embodiment shown in FIG. 14.

Step 406: Retrieve an input parameter required for creating an operationrequest for the operation resource CloseWindow. For detailed steps,reference may be made to an embodiment shown in FIG. 11.

Step 407: According to a request type (Method) and an object resource(Object Resource) included in the representation of the operationresource CloseWindow and the input parameter retrieved in step 406,construct the operation request to be sent. In this embodiment, the typeof the operation request is create (Create), a URI of the objectresource is http://gscl3/window, and the retrieved input parameter(Input) is OFF. In the ETSI M2M standard, an operation requesttransmitted on a standard RESTful interface may be constructed accordingto the foregoing attributes.

Step 408: Send the operation request constructed in step 407 to a GSCL3,where the operation request may be specifically sent by using a standardRESTful interface defined in an M2M system, and receive an operationresponse that is returned by the GSCL3 after the operation in theoperation request, for example, closing a window, is completed by awindow controller.

Step 409: Retrieve an execution result corresponding to the operationrequest. For detailed steps, reference may be made to an embodimentshown in FIG. 15.

Step 410: With respect to the priorities of the operation resourcesselected in step 403, select a remaining operation resource of a highestpriority, and continue to execute the following steps. In thisembodiment, the operation resource TurnOnAC is selected in this step.

Step 411: Determine that a condition defined by Rule in a representationof a dependency resource associated with the operation resource TurnOnACis met. For detailed steps, reference may be made to the embodimentshown in FIG. 14.

Step 412: Retrieve an input parameter required for creating an operationrequest for the TurnOnAC. For detailed steps, reference may be made tothe embodiment shown in FIG. 11.

Step 413: According to a type (Method) and an object resource (ObjectResource) included in the operation resource TurnOnAC and the inputparameter retrieved in step 412, construct the operation request to besent. In this embodiment, the type of the operation request is create(Create), a URI of the object resource is http://gscl2/airCondition, andthe retrieved input parameter (Input) is ON. With reference to the ETSIM2M standard, an operation request transmitted on a standard RESTfulinterface may be constructed according to the foregoing attributes.

Step 414: Send the operation request created in step 413 to the GSCL2,where the operation request may be specifically sent by using a standardRESTful interface defined in the M2M system, and receive an operationresponse.

Step 415: Retrieve an operation execution result. For detailed steps,reference may be made to the embodiment shown in FIG. 15.

In the embodiment shown in FIG. 10, the GSCL2, GSCL1, and GSCL3 may be asame GSCL, or may be different GSCLs, which is not limited herein in theembodiment of the present invention.

Input included in a representation of an operation resource indicates aninput parameter required for constructing an operation request.operation requests of the types of operation requests specified by theRESTful architecture, delete (Delete) and retrieve (Retrieve) do notrequire an input parameter, but operation requests of create (Create)and update (Update) need to carry representations of object resourcesfor creating an object resource and updating an object resourcerespectively. In step 406 and step 412 in the foregoing embodiment shownin FIG. 10, the input parameters are retrieved when the operationrequests for the operation resources CloseWindow and TurnOnAC areconstructed separately. A specific process thereof is shown in FIG. 11,where a URI saved in the input parameter is http://gscl3/OFF, andservice capability middleware in which a resource pointed to by the URIis located is the GSCL3. As shown in FIG. 11, a process for determiningwhether an input parameter needs to be retrieved may include thefollowing steps:

Step 501: Start the process. Determine an operation corresponding to anoperation resource that needs to be executed, for example, the operationcorresponding to the operation resource CloseWindow or the operationcorresponding to the operation resource TurnOnAC.

Step 502: Determine an operation request type (Method) in arepresentation of the operation resource that is being executed. In thisembodiment, both the request types (Method) in the representations ofthe operation resources CloseWindow and TurnOnAC are create (Create),and step 503 is executed. In addition, if the request type is delete(Delete) or retrieve (Retrieve), an input parameter does not need to beconsidered when an operation request is constructed, and step 506 may beexecuted directly.

Step 503: Determine whether a URI of a parameter resource is saved in aninput parameter Input in the representation of the operation resourcethat is being executed.

The URI is in a fixed format, and made up of parts such as a schema, ahost, a port, and a path. For details, reference may be made to IETF RFC3305. The URI saved in the input parameter Input indicates that theinput parameter required for constructing the operation request is arepresentation of the parameter resource pointed to by the URI. Forexample, for the operation resource CloseWindow in this embodiment, theURI http://gscl2/OFF is saved in the input parameter Input in therepresentation of the operation resource. If the URI is saved in theinput parameter, the process proceeds to step 505. If no URI is saved inthe input parameter, but a representation of a resource is directlysaved as a representation of a new object resource, the process proceedsto step 504.

Step 504: Construct an operation request of the create type, anddirectly use a representation of an object resource saved in the inputparameter, as content of the operation request. For example,<textContent>ON<textContent> is saved in the input parameter in therepresentation of the operation resource TurnOnAC, and the text segmentis the input parameter that is required for creating the operationrequest for the operation resource TurnOnAC.

Step 505: When the input parameter in the representation of theoperation resource that is being executed is the URI, a retrieve requestneeds to be sent to the URI to retrieve a representation of a resourcepointed to by the URI as the representation of the new object resource.For example, the URI saved in the input parameter Input in therepresentation of the operation resource CloseWindow ishttp://gscl3/OFF, which indicates that the GSCL1 (the service capabilitymiddleware in which the Temperature is located) needs to send a retrieverequest (Retrieve) to the GSCL3 (the service capability middleware inwhich http://gscl3/OFF is located) to retrieve a representation of aresource indicated by http://gscl3/OFF as the representation of the newobject resource.

Step 506: The input parameter is not required for constructing anoperation request of the delete or retrieve type, and the processdirectly proceeds to step 507.

Step 507: Execute the steps next to step 406 and step 412 in theembodiment shown in FIG. 10.

In step 405 and step 411 in the embodiment shown in FIG. 10, before theoperations are executed, it is necessary to determine whether theconditions defined by the rules in the representations of the dependencyresources of the operation resources are met. In this embodiment, it isto determine whether a condition defined by Rule in a representation ofeach dependency resource of the operation resources TurnOnAC andCloseWindow can be met. In the system architecture shown in FIG. 7, aD′A2 is a bedroom window sensor application program used to detectwhether a window in a bedroom is closed, and this application programuses a representation of a BedroomWindowStatus resource in the GSCL1 toindicate a current status of the window in the bedroom. A URI of theBedroomWindowStatus resource is http://gscl1/bedroomWindowStatus. A D′A3is a living room window sensor application program used to detectwhether a window in a living room is closed, and this applicationprogram uses a representation of a LivingroomWindowStatus resource inthe GSCL1 to indicate a current status of the window in the living room.A URI of the LivingroomWindowStatus resource ishttp://gscl1/livingroomWindowStatus. In the current embodiment, when therepresentation of the temperature resource is higher than 30° C., thewindows needs to be closed before the air conditioner is turned on.Before the operation of closing the windows is executed, it is necessaryto determine whether the windows in the living room and bedroom havebeen closed. That is, execution of the operation of the operationresource CloseWindow further depends on the representations of the twodependency resources BedroomWindowStatus and LivingroomWindowStatus. Ifone window is not closed, the operation of closing a window needs to beexecuted.

Meanwhile, the operation of turning on the air conditioner is executedonly after it is ensured that all the windows are closed and it isdetermined that the host is at home. In summary, the architecture of thedependency resource sets of the updated operation resource TurnOnAC forturning on the air conditioner and the updated operation resourceCloseWindow for closing the windows may be shown in FIG. 12 and FIG. 13.

For each operation resource, determining whether a condition defined byRule in a representation of a dependency resource associated with theoperation resource may include the steps shown in FIG. 14.

Step 601: Start.

Step 602: The GSCL1 determines all the dependency resources associatedwith the operation resources, where the dependency resources associatedwith the operation resource TurnOnAC include MemberAtHome,LivingroomWindowClosed, and BedroomWindowClosed, and the dependencyresources associated with the operation resource CloseWindow includeLivingroomWindowOpen and BedroomWindowOpen.

Step 603: Select one dependency resource associated with each operationresource in sequence, and execute the following step 604 to step 610 foreach dependency resource.

Step 604: According to a URI in the representation of the dependencyresource, retrieve a representation of a condition resource pointed toby the URI; for example, according to http://nscl/hospLocation, retrievea representation of a condition resource pointed to by the URI, that is,retrieve the location of the host.

Step 605: Determine whether the representation of the condition resourcemeets the condition defined by Rule in the dependency resource. If thecondition is met, execute step 606; otherwise, execute step 607.

In this embodiment, assuming that the location of the host is at home,the representation of the condition resource meets the condition definedby Rule in the dependency resource.

Step 606: Determine whether a type of the dependency resource is thesufficient condition type or the necessary condition type. If it is thesufficient condition type, execute step 609; if it is the necessarycondition type, execute step 608.

In this embodiment, the type of the dependency resource MemberAtHome isAND, that is, the necessary condition type, and therefore, it is furthernecessary to determine whether a condition in another dependencyresource is met.

Step 607: Determine whether a type of the dependency resource is thesufficient condition type or the necessary condition type. If it is thenecessary condition type, execute step 610; if it is the sufficientcondition type, execute step 608.

Step 608: Determine whether the dependency resource is a last dependencyresource. If the dependency resource is not the last dependencyresource, execute step 603. If the dependency resource is the lastdependency resource, there are two cases: if it is determined in step605 that the representation of the condition resource meets thecondition defined by Rule in the dependency resource, execute step 609;if it is determined in step 605 that the representation of the conditionresource does not meet the condition defined by Rule in the dependencyresource, execute step 610.

Step 609: Proceed to execute a next step, that is, step 406 and step 412in the embodiment shown in FIG. 10.

Step 610: Terminate the operation for the operation resource.

Specifically, for the operation resource CloseWindow, the dependencyresource first selected in step 603 is the LivingroomWindowOpen; arepresentation of a resource indicating whether the window in the livingroom is opened, namely, a closed state (Closed), is further retrievedaccording to the URI http://gscl1/livingroomWindowStatus of thedependency resource LivingroomWindowOpen in step 604; in step 605, it isdetermined whether the representation of the resource retrieved in step604 and indicating whether the window in the living room is opened meetsthe condition defined by Rule in the representation of the dependencyresource LivingroomWindowOpen, the condition defined by Rule in therepresentation of the dependency resource LivingroomWindowOpen is anopen state (Open), and therefore, a determining result is that thecondition is not met, and step 607 is executed; in step 607, it isdetermined that the type of the dependency resource defined by logic(Logic) in the representation of the dependency resourceLivingroomWindowOpen is the sufficient condition type (OR), andtherefore, step 608 is further executed; in step 608, it is determinedthat, for the operation resource CloseWindow, there is anotherdependency resource on which determining has not been performed, andtherefore, the process returns to step 603; in step 603, the nextdependency resource BedroomWindowOpen is selected, and a representationof a resource indicating whether the window in the bedroom is opened,namely, an open state (Open), is retrieved according to the URIhttp://gscl1/bedroomWindowStatus of the dependency resourceBedroomWindowOpen in step 604. In step 605, it is determined whether therepresentation of the resource retrieved in step 604 and indicatingwhether the window in the bedroom is opened meets the condition definedby Rule in the representation of the dependency resourceBedroomWindowOpen, the condition defined by Rule in the representationof the dependency resource BedroomWindowOpen is an open state (Open),and therefore, a determining result is that the condition is met, andstep 606 is executed; in step 606, it is determined that the type of thedependency resource defined by logic (Logic) in the representation ofthe dependency resource BedroomWindowOpen is the sufficient conditiontype, and step 609 is executed.

For the operation resource TurnOnAC, the dependency resourceLivingroomWindowClosed is selected first in step 603, and therepresentation of the resource indicating whether the window in theliving room is opened, namely, the closed state (Closed), is retrievedaccording to the URI http://gscl1/livingroomWindowStatus of thedependency resource LivingroomWindowClosed in step 604 is. In step 605,it is determined whether the representation of the resource retrieved instep 604 and indicating whether the window in the living room is openedmeets the condition defined by Rule in the representation of theLivingroomWindowOpen, the condition defined by Rule in therepresentation of the dependency resource LivingroomWindowOpen is theclosed state (Closed), and therefore, a determining result is that thecondition is met, and step 606 is executed. In step 606, it isdetermined that the type of the dependency resource defined by the logic(Logic) in the representation of the dependency resourceLivingroomWindowOpen is the necessary condition type (AND), andtherefore, step 608 is further executed; in step 608, it is determinedwhether there is another dependency resource that is associated with theoperation resource TurnOnAC and on which determining has not beenperformed. Because the dependency resource BedroomWindowClosed exists,step 603 is executed, and the dependency resource BedroomWindowClosed isselected. The representation of the resource indicating whether thewindow in the bedroom is opened, namely, the closed state (Closed), isretrieved according to the URI http://gscl1/bedroomWindowStatus of thedependency resource BedroomWindowClosed in step 604 is. In step 605, itis determined whether the representation of the resource retrieved instep 604 and indicating whether the window in the bedroom is openedmeets the condition defined by Rule in the representation of thedependency resource BedroomWindowOpen, the condition defined by Rule inthe representation of the dependency resource BedroomWindowOpen is theclosed state (Closed), and therefore, a determining result is that thecondition is not met, and step 607 is executed. In step 607, it isfurther determined that the logic (Logic) in the representation of thedependency resource MemberAtHome defines that the type of the dependencyresource is the necessary condition type, and step 610 is executeddirectly.

The following is an embodiment of how to retrieve execution results ofoperation requests after operations are triggered by a change of asubject resource. For details, reference may be made to step 409 andstep 415 in the embodiment shown in FIG. 10, where operation executionresults need to be retrieved after operation requests for the operationresource CloseWindow and operation resource TurnOnAC are sentseparately. As shown in the resource structural diagram of the operationresource TurnOnAC shown in FIG. 5 and the resource structural diagram ofthe operation resource CloseWindow shown in FIG. 8, Output URI of theoperation resource TurnOnAC is N/A, while Output URI of the operationresource CloseWindow is http://gscl2/allWindowStatus. A specific processof retrieving the operation execution results may include the stepsshown in FIG. 15.

Step 701: Referring to step 409 and step 415 in the embodiment shown inFIG. 10, start after the operation requests for the operation resourceCloseWindow and operation resource TurnOnAC are sent and operationresponses are received.

Step 702: The GSCL1 determines whether the addresses (Output URI)reflecting the operation execution results in the representations of theoperation resources are N/A. In this embodiment, Output URI in therepresentation of the operation resource TurnOnAC is N/A, and step 703is executed, while Output URI in the representation of the operationresource CloseWindow is not N/A, and step 704 is executed.

Step 703: As shown in step 415 in the embodiment shown in FIG. 10, theprocess of retrieving the operation execution results occurs after theoperation requests are sent and the operation responses are received. Ina case in which Output URI in the representation of the operationresource is N/A, the operation response is directly saved into theexecution result Result. For the operation resource TurnOnAC, theoperation response corresponding to the operation request of the create(Create) type is OK, and therefore, OK is saved into Result in therepresentation of the operation resource TurnOnAC.

Step 704: In a case in which Output URI of the operation resource is notN/A, the address reflecting the operation execution result, that is, aURI of a resource that stores the operation execution result, is savedinto Output URI. Therefore, a retrieve request is sent to the URI of theresource that stores the operation execution result, so that therepresentation of the resource is retrieved. For the operation resourceCloseWindow, a retrieve request is sent to the URIhttp://gscl2/allWindowStatus of the resource that stores the operationexecution result, and a retrieve response is received, where theretrieve response includes the representation of the allWindowStatusresource, that is, all windows are closed (Closed).

Step 705: Save the representation of the allWindowStatus resourceretrieved in step 704 into the execution result Result in therepresentation of the operation resource CloseWindow.

Step 706: End.

An embodiment of the present invention further provides an apparatuscorresponding to the foregoing method. FIG. 16 is schematic structuraldiagram 1 of an operation triggering apparatus for machine-to-machinecommunications according to an embodiment of the present invention,where the apparatus stores a representation of a subject resource, wherethe representation of the subject resource includes content of thesubject resource and information about an operation resource associatedwith the subject resource, as shown in FIG. 16.

The apparatus includes a retrieving module 11, a constructing module 12,and a sending module 13. The retrieving module 11 is configured toretrieve a change result of the stored content of the subject resourcewhen the content of the subject resource is changed, and retrieve,according to the information about the operation resource associatedwith the subject resource, a representation of the operation resourceassociated with the subject resource, where the representation of theoperation resource includes a condition for sending an operation requestto an object resource and a uniform resource identifier of the objectresource; the retrieving module is further configured to send the changeresult and the representation of the operation resource to theconstructing module; the constructing module 12 is configured to receivethe change result and the representation of the operation resourceassociated with the subject resource, and when it is determined that thechange result meets the condition for sending the operation request tothe object resource in the representation of the operation resource,construct the operation request for the object resource, and send theoperation request to the sending module; and the sending module 13 isconfigured to receive the operation request, and send the operationrequest to the object resource according to the uniform resourceidentifier of the object resource.

In the technical solution provided by the foregoing embodiment of thepresent invention, when the content of the subject resource is changed,the apparatus that stores the change result of the content of thesubject resource retrieves, according to the information about theoperation resource associated with the subject resource, therepresentation of the operation resource associated with the subjectresource, and constructs the operation request for the object resourcein the representation of the operation resource, and finally sends theoperation request to the object resource in the representation of theoperation resource. The operation triggering apparatus formachine-to-machine communications in the foregoing embodiment of thepresent invention may be middleware on an M2M platform or gateway. Boththe M2M platform and the gateway are nodes having capabilities in anetwork, and therefore a problem of capability restriction does notexist, which is advantageous for handling situations in which servicescannot be performed in restricted environments.

Further, the information about the operation resource associated withthe subject resource is the representation of the operation resourceassociated with the subject resource, and that the retrieving moduleretrieves, according to the information about the operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, is specifically:retrieving, according to the representation, included in therepresentation of the subject resource, of the operation resourceassociated with the subject resource, the representation of theoperation resource associated with the subject resource; or theinformation about the operation resource associated with the subjectresource is a uniform resource identifier of the operation resourceassociated with the subject resource, and that the retrieving moduleretrieves, according to the information about the operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, is specifically:retrieving, according to the uniform resource identifier of theoperation resource included in the representation of the subjectresource, the representation of the operation resource associated withthe subject resource; or the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofan operation resource set to which the operation resource associatedwith the subject resource belongs, and that the retrieving moduleretrieves, according to the information about the operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, is specifically:retrieving, according to the uniform resource identifier, included inthe representation of the subject resource, of the operation resourceset to which the operation resource belongs, the representation of theoperation resource associated with the subject resource, where therepresentation of the operation resource associated with the subjectresource is a representation of an operation resource included in theoperation resource set.

The operation triggering apparatus for machine-to-machine communicationsaccording to the foregoing embodiment of the present invention mayfurther include a receiving module, where the receiving module isconfigured to receive a subject resource update request before theretrieving module retrieves the change result of the content of thesubject resource stored in the apparatus, where the subject resourceupdate request includes a representation of a new subject resource and auniform resource identifier of the subject resource to be updated, wherethe representation of the new subject resource includes informationabout an operation resource associated with the new subject resource,and the receiving module updates the stored representation of thesubject resource to the representation of the new subject resourceaccording to the uniform resource identifier of the subject resource tobe updated; or the receiving module is configured to receive anoperation resource create request before the retrieving module retrievesthe change result of the content of the subject resource stored in theapparatus, where the operation resource create request includes therepresentation of the operation resource associated with the subjectresource and the uniform resource identifier of the operation resourceset to which the operation resource belongs, and the receiving moduleadds the representation of the operation resource to the operationresource set according to the uniform resource identifier of theoperation resource set to which the operation resource belongs.

In addition, in the foregoing embodiment of the present invention, therepresentation of the operation resource further includes a type of theoperation request and an input parameter of the operation request, wherethe type of the operation request is create or update; and when theinput parameter is a uniform resource identifier of a parameterresource, that the constructing module constructs the operation requestfor the object resource is specifically: retrieving a representation ofa new object resource from the parameter resource that is pointed to bythe uniform resource identifier of the parameter resource, andconstructing the operation request that includes the uniform resourceidentifier of the object resource and the representation of the newobject resource and that is for the object resource in therepresentation of the operation resource; or when the input parameter isa representation of a new object resource, that the constructing moduleconstructs the operation request for the object resource isspecifically: constructing the operation request that includes theuniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource.

In addition, the receiving module in the foregoing operation triggeringapparatus for machine-to-machine communications is further configured toreceive an operation resource update request before the retrievingmodule retrieves the change result of the content of the subjectresource stored in the service capability middleware, where theoperation resource update request includes a representation of a newoperation resource, where the representation of the new operationresource includes a representation of a dependency resource or a uniformresource identifier of a dependency resource, and is configured toupdate the stored representation of the operation resource to therepresentation of the new operation resource; or the receiving module isfurther configured to receive a dependency resource create requestbefore the retrieving module retrieves the change result of the contentof the subject resource stored in the service capability middleware,where the dependency resource create request includes a representationof a dependency resource and a uniform resource identifier of adependency resource set to which the dependency resource belongs, and isconfigured to save the representation of the dependency resource to thedependency resource set according to the uniform resource identifier ofthe dependency resource set to which the dependency resource belongs,and add the uniform resource identifier of the dependency resource setto the representation of the operation resource.

Further, in the technical solution in which the dependency resourceexists, the foregoing apparatus may further include a determiningmodule. The retrieving module is further configured to retrieve,according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, retrieve a representation of a condition resource that ispointed to by a uniform resource identifier in the representation of thedependency resource, and send the representation of the conditionresource and a condition in the representation of the dependencyresource to the determining module; and the determining module isconfigured to receive the representation of the condition resource, anddetermine, according to the representation of the condition resource,that the condition in the representation of the dependency resource ismet.

Specifically, types of the dependency resource are classified into asufficient condition type and a necessary condition type, and adependency resource quantity is at least one; and before theconstructing module constructs the operation request for the objectresource in the representation of the operation resource, thedetermining module is further configured to determine that a conditionspecified by at least one dependency resource of the sufficientcondition type is met; or before the constructing module constructs theoperation request for the object resource in the representation of theoperation resource, the determining module is further configured todetermine that conditions specified by all dependency resources of thenecessary condition type are met.

The association relationship between the operation resource and thedependency resource may be implemented in three manners. Specifically,that the retrieving module retrieves, according to the representation ofthe operation resource, the representation of the dependency resourceassociated with the operation resource, is specifically: retrieving,according to the representation of the dependency resource included inthe representation of the operation resource, the representation of thedependency resource associated with the operation resource; orretrieving, according to the uniform resource identifier of thedependency resource included in the representation of the operationresource, the representation of the dependency resource associated withthe operation resource; or retrieving, according to the uniform resourceidentifier, included in the representation of the operation resource, ofthe dependency resource set to which the dependency resource belongs,the representation of the dependency resource associated with theoperation resource, where the representation of the dependency resourceassociated with the operation resource is a representation of adependency resource included in the dependency resource set.

In the foregoing embodiment of the present invention, at least twooperation resources are associated with the subject resource,representations of the operation resources further include priorities,and that the constructing module constructs the operation request forthe object resource in the representation of the operation resource isspecifically: constructing an operation request for an object resourcein the representation of each operation resource in sequence accordingto the priorities in the representations of the operation resources.

In the foregoing embodiment of the present invention, the representationof the operation resource further includes an operation executionresult, and the receiving module is further configured to receive anoperation response returned by a device that the object resource islocated, and save the operation response into the operation executionresult in the representation of the operation resource; or therepresentation of the operation resource further includes an addressreflecting an operation execution result and the operation executionresult, and the receiving module is further configured to receive anoperation response returned by the device in which the object resourceis located, and the retrieving module is further configured to retrieve,according to the address reflecting the operation execution result, anoperation result corresponding to the operation request, and save theoperation result corresponding to the operation request into theoperation execution result.

In addition, an embodiment of the present invention further providesanother operation triggering apparatus for machine-to-machinecommunications. FIG. 17 is schematic structural diagram 2 of anoperation triggering apparatus for machine-to-machine communicationsaccording to an embodiment of the present invention. As shown in FIG.17, the operation triggering apparatus for machine-to-machinecommunications includes a network interface 21, a processor 22, and amemory 23.

The network interface 21 is configured to perform communication with anexternal device; the memory 23 is configured to store an applicationprogram and store a representation of a subject resource, where therepresentation of the subject resource includes content of the subjectresource and information about an operation resource associated with thesubject resource; the processor 22 is configured to: invoke theapplication program stored in the memory; when the content of thesubject resource is changed, retrieve a change result of the content ofthe subject resource stored in the memory, and retrieve, according tothe information about the operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource, where the representation of the operation resourceincludes a condition for sending an operation request to an objectresource and a uniform resource identifier of the object resource; andwhen it is determined that the change result meets the condition forsending the operation request to the object resource in therepresentation of the operation resource, construct the operationrequest for the object resource; and the network interface 21 is furtherconfigured to send the operation request to the object resourceaccording to the uniform resource identifier of the object resource.

In the technical solution provided by the foregoing embodiment of thepresent invention, the network interface 21, processor 22, and memory 23may be connected by a system bus 24; when the content of the subjectresource is changed, the service capability middleware that stores thechange result of the content of the subject resource retrieves,according to the information about the operation resource associatedwith the subject resource, the representation of the operation resourceassociated with the subject resource, and constructs the operationrequest for the object resource in the representation of the operationresource, and finally sends the operation request to the object resourcein the representation of the operation resource. The computer device inthe foregoing embodiment of the present invention may be an M2M platformor gateway. Both the M2M platform and the gateway are nodes havingcapabilities in a network, and therefore a problem of capabilityrestriction does not exist, which is advantageous for handlingsituations in which services cannot be performed in restrictedenvironments.

In the foregoing embodiment of the present invention, the informationabout the operation resource associated with the subject resource is therepresentation of the operation resource associated with the subjectresource, and that the processor retrieves, according to therepresentation of the subject resource, a representation of theoperation resource associated with the subject resource, isspecifically: retrieving, according to the representation of theoperation resource included in the representation of the subjectresource, the representation of the operation resource associated withthe subject resource; or the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofthe operation resource associated with the subject resource, and thatthe processor retrieves, according to the representation of the subjectresource, a representation of the operation resource associated with thesubject resource, is specifically: retrieving, according to the uniformresource identifier of the operation resource included in therepresentation of the subject resource, the representation of theoperation resource associated with the subject resource; or theinformation about the operation resource associated with the subjectresource is a uniform resource identifier of an operation resource setto which the operation resource associated with the subject resourcebelongs, and that the processor retrieves, according to therepresentation of the subject resource, a representation of theoperation resource associated with the subject resource, isspecifically: retrieving, according to the uniform resource identifier,included in the representation of the subject resource, of the operationresource set to which the operation resource belongs, the representationof the operation resource associated with the subject resource, wherethe representation of the operation resource associated with the subjectresource is a representation of an operation resource included in theoperation resource set.

In addition, the network interface is further configured to receive asubject resource update request, where the subject resource updaterequest includes a representation of a new subject resource and auniform resource identifier of the subject resource to be updated, wherethe representation of the new subject resource includes informationabout an operation resource associated with the new subject resource,and the processor invokes the application program stored in the memoryto update the stored representation of the subject resource to therepresentation of the new subject resource according to the uniformresource identifier of the subject resource to be updated; or thenetwork interface is further configured to receive an operation resourcecreate request, where the operation resource create request includes therepresentation of the operation resource associated with the subjectresource and the uniform resource identifier of the operation resourceset to which the operation resource associated with the subject resourcebelongs, and the processor invokes the application program stored in thememory to add the representation of the operation resource to theoperation resource set according to the uniform resource identifier ofthe operation resource set to which the operation resource belongs.

In the foregoing embodiment of the present invention, the representationof the operation resource further includes a type of the operationrequest and an input parameter of the operation request, where the typeof the operation request is create or update; and when the inputparameter is a uniform resource identifier of a parameter resource, theprocessor retrieves a representation of a new object resource from theparameter resource that is pointed to by the uniform resource identifierof the parameter resource, and constructs the operation request thatincludes the uniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource; or when theinput parameter is a representation of a new object resource, theprocessor constructs the operation request that includes the uniformresource identifier of the object resource and the representation of thenew object resource and that is for the object resource in therepresentation of the operation resource.

In the foregoing embodiment of the present invention, the networkinterface is further configured to receive an operation resource updaterequest, where the operation resource update request includes arepresentation of a new operation resource, where the representation ofthe new operation resource includes a representation of a dependencyresource or a uniform resource identifier of a dependency resource, andthe processor invokes the application program stored in the memory toupdate the stored representation of the operation resource to therepresentation of the new operation resource; or the network interfaceis further configured to receive a dependency resource create request,where the dependency resource create request includes a representationof a dependency resource and a uniform resource identifier of adependency resource set to which the dependency resource belongs, andthe processor invokes the application program stored in the memory tosave the representation of the dependency resource to the dependencyresource set according to the uniform resource identifier of thedependency resource set to which the dependency resource belongs, andadd the uniform resource identifier of the dependency resource set tothe representation of the operation resource.

Further, the processor in the foregoing embodiment further retrieves,according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, retrieves a representation of a condition resource that ispointed to by a uniform resource identifier in the representation of thedependency resource, and determines, according to the representation ofthe condition resource, that a condition in the representation of thedependency resource is met.

Types of the dependency resource are classified into a sufficientcondition type and a necessary condition type, a dependency resourcequantity is at least one, and before constructing the operation requestfor the object resource in the representation of the operation resource,the processor further determines that a condition specified by at leastone dependency resource of the sufficient condition type is met (thatis, the processor constructs the operation request for the objectresource in the representation of the operation resource whendetermining that a condition specified by at least one dependencyresource of the sufficient condition type is met); or beforeconstructing the operation request for the object resource in therepresentation of the operation resource, the processor furtherdetermines that conditions specified by all dependency resources of thenecessary condition type are met (that is, the processor constructs theoperation request for the object resource in the representation of theoperation resource when determining that conditions specified by alldependency resources of the necessary condition type are met).

The processor retrieves, according to the representation of thedependency resource included in the representation of the operationresource, the representation of the dependency resource associated withthe operation resource; or retrieves, according to the uniform resourceidentifier of the dependency resource included in the representation ofthe operation resource, the representation of the dependency resourceassociated with the operation resource; or retrieves, according to theuniform resource identifier, included in the representation of theoperation resource, of the dependency resource set to which thedependency resource belongs, the representation of the dependencyresource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

In addition, at least two operation resources are associated with thesubject resource, representations of the operation resources furtherinclude priorities, and the processor constructs an operation requestfor an object resource in the representation of each operation resourcein sequence according to the priorities in the representations of theoperation resources.

The representation of the operation resource further includes anoperation execution result, the network interface is further configuredto receive an operation response returned by the device in which theobject resource is located, and the processor saves the operationresponse into the operation execution result in the representation ofthe operation resource; or the representation of the operation resourcefurther includes an address reflecting an operation execution result andthe operation execution result, the network interface is furtherconfigured to receive an operation response returned by the device inwhich the object resource is located, and the processor retrieves,according to the address reflecting the operation execution result, anoperation result corresponding to the operation request, and saves theoperation result corresponding to the operation request into theoperation execution result.

Persons of ordinary skill in the art may understand that all or some ofthe steps of the method embodiments may be implemented by a programinstructing relevant hardware. The program may be stored in acomputer-readable storage medium. When the program runs, the steps ofthe method embodiments are performed. The foregoing storage mediumincludes: any medium that can store program code, such as a ROM, a RAM,a magnetic disk, or an optical disc.

Finally, it should be noted that the foregoing embodiments are merelyintended for describing the technical solutions of the presentinvention, but not for limiting the present invention. Although thepresent invention is described in detail with reference to the foregoingembodiments, persons of ordinary skill in the art should understand thatthey may still make modifications to the technical solutions describedin the foregoing embodiments or make equivalent replacements to some orall technical features thereof, without departing from the scope of thetechnical solutions of the embodiments of the present invention.

What is claimed is:
 1. An operation triggering method formachine-to-machine communications, wherein a service capabilitymiddleware stores a representation of a subject resource, therepresentation of the subject resource comprising content of the subjectresource and information about an operation resource associated with thesubject resource, the method comprising: retrieving, by the servicecapability middleware, a change result of the content of the subjectresource stored in the service capability middleware when the content ofthe subject resource is changed; retrieving, by the service capabilitymiddleware, according to the information about the operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, wherein therepresentation of the operation resource comprises a condition forsending an operation request to an object resource and a uniformresource identifier of the object resource; constructing the operationrequest for the object resource when the service capability middlewaredetermines that the change result meets the condition for sending theoperation request to the object resource in the representation of theoperation resource; and sending, by the service capability middleware,the operation request to the object resource according to the uniformresource identifier of the object resource.
 2. The method according toclaim 1, wherein: the information about the operation resourceassociated with the subject resource is the representation of theoperation resource associated with the subject resource, and theretrieving of a representation of the operation resource associated withthe subject resource comprises retrieving, by the service capabilitymiddleware, according to the representation comprised in therepresentation of the subject resource of the operation resourceassociated with the subject resource, the representation of theoperation resource associated with the subject resource; or theinformation about the operation resource associated with the subjectresource is a uniform resource identifier of the operation resourceassociated with the subject resource, and the retrieving of arepresentation of the operation resource associated with the subjectresource comprises retrieving, by the service capability middlewareaccording to the uniform resource identifier of the operation resourcecomprised in the representation of the subject resource, therepresentation of the operation resource associated with the subjectresource; or the information about the operation resource associatedwith the subject resource is a uniform resource identifier of anoperation resource set to which the operation resource associated withthe subject resource belongs, and the retrieving of a representation ofthe operation resource associated with the subject resource comprisesretrieving, by the service capability middleware according to theuniform resource identifier comprised in the representation of thesubject resource of the operation resource set to which the operationresource belongs, the representation of the operation resourceassociated with the subject resource, wherein the representation of theoperation resource associated with the subject resource is arepresentation of an operation resource comprised in the operationresource set.
 3. The method according to claim 1, further comprising:receiving, by the service capability middleware, a subject resourceupdate request comprising a representation of a new subject resource anda uniform resource identifier of a subject resource to be updated,wherein the representation of the new subject resource comprisesinformation about an operation resource associated with the new subjectresource; and updating, by the service capability middleware, the storedrepresentation of the subject resource to the representation of the newsubject resource according to the uniform resource identifier of thesubject resource to be updated; or receiving, by the service capabilitymiddleware, an operation resource create request comprising therepresentation of the operation resource associated with the subjectresource and the uniform resource identifier of the operation resourceset to which the operation resource associated with the subject resourcebelongs; and adding, by the service capability middleware, therepresentation of the operation resource to the operation resource setaccording to the uniform resource identifier of the operation resourceset to which the operation resource belongs.
 4. The method accordingclaim 1, wherein the representation of the operation resource furthercomprises a type of the operation request and an input parameter of theoperation request, wherein the type of the operation request is createor update; and when the input parameter is a uniform resource identifierof a parameter resource, the constructing the operation request for theobject resource comprises retrieving, by the service capabilitymiddleware, a representation of a new object resource from the parameterresource that is pointed to by the uniform resource identifier of theparameter resource; and constructing the operation request thatcomprises the uniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource; or when theinput parameter is a representation of a new object resource, theconstructing the operation request for the object resource comprisesconstructing, by the service capability middleware, the operationrequest that comprises the uniform resource identifier of the objectresource and the representation of the new object resource and that isfor the object resource in the representation of the operation resource.5. The method according to claim 1, further comprising: receiving, bythe service capability middleware, an operation resource update requestcomprising a representation of a new operation resource, wherein therepresentation of the new operation resource comprises a representationof a dependency resource or a uniform resource identifier of adependency resource; and updating, by the service capability middleware,the stored representation of the operation resource to therepresentation of the new operation resource; or receiving, by theservice capability middleware, a dependency resource create requestcomprising a representation of a dependency resource and a uniformresource identifier of a dependency resource set to which the dependencyresource belongs; saving, by the service capability middleware, therepresentation of the dependency resource to the dependency resource setaccording to the uniform resource identifier of the dependency resourceset to which the dependency resource belongs; and adding the uniformresource identifier of the dependency resource set to the representationof the operation resource.
 6. The method according to claim 5, furthercomprising: retrieving, by the service capability middleware, accordingto the representation of the operation resource, the representation ofthe dependency resource associated with the operation resource;retrieving, by the service capability middleware, a representation of acondition resource that is pointed to by a uniform resource identifierin the representation of the dependency resource; and determining, bythe service capability middleware, according to the representation ofthe condition resource, that a condition in the representation of thedependency resource is met.
 7. The method according to claim 6, whereintypes of the dependency resource are classified into a sufficientcondition type and a necessary condition type, a dependency resourcequantity is a sufficient condition type, a necessary condition type, orboth, and the method further comprises: determining that a conditionspecified by a dependency resource of the sufficient condition type ismet; or determining that conditions specified by all dependencyresources of the necessary condition type are met.
 8. The methodaccording to claim 6, wherein the retrieving of the representation ofthe dependency resource associated with the operation resourcecomprises: retrieving, by the service capability middleware, accordingto the representation of the dependency resource comprised in therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource; orretrieving, by the service capability middleware, according to theuniform resource identifier of the dependency resource comprised in therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource; orretrieving, by the service capability middleware, according to theuniform resource identifier comprised in the representation of theoperation resource of the dependency resource set to which thedependency resource belongs, the representation of the dependencyresource associated with the operation resource, wherein therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource comprised in thedependency resource set.
 9. The method according to claim 1, furthercomprising: determining that a plurality of operation resources areassociated with the subject resource, wherein representations of theoperation resources further comprise priorities, and the constructing,by the service capability middleware, the operation request for theobject resource in the representation of the operation resource,comprises: constructing, by the service capability middleware, anoperation request for an object resource in the representation of eachoperation resource in sequence according to the priorities in therepresentations of the operation resources.
 10. The method according toclaim 1, wherein the representation of the operation resource furthercomprises an operation execution result, and the method furthercomprises receiving, by the service capability middleware, an operationresponse returned by a device on which the object resource is located;and saving the operation response into the operation execution result inthe representation of the operation resource; or the representation ofthe operation resource further comprises an address reflecting anoperation execution result and the operation execution result, and themethod further comprises receiving, by the service capabilitymiddleware, an operation response returned by a device that the objectresource is located; retrieving, according to the address reflecting theoperation execution result, an operation result corresponding to theoperation request; and saving the operation result corresponding to theoperation request into the operation execution result.
 11. An operationtriggering apparatus for machine-to-machine communications, comprising:a computer; and a memory, configured to store a representation of asubject resource, wherein the representation of the subject resourcecomprises content of the subject resource and information about anoperation resource associated with the subject resource, and furtherconfigured to store program modules executable by the computer, themodules including: a retrieving module, configured to: retrieve a changeresult of the stored content of the subject resource when the content ofthe subject resource is changed; retrieve, according to the informationabout the operation resource associated with the subject resource, arepresentation of the operation resource associated with the subjectresource, wherein the representation of the operation resource comprisesa condition for sending an operation request to an object resource and auniform resource identifier of the object resource, and send the changeresult and the representation of the operation resource to aconstruction module; a construction module, configured to receive thechange result and the representation of the operation resourceassociated with the subject resource, and when it is determined that thechange result meets the condition for sending the operation request tothe object resource in the representation of the operation resource,construct the operation request for the object resource, and send theoperation request to a sending module; and a sending module, configuredto receive the operation request, and send the operation request to theobject resource according to the uniform resource identifier of theobject resource.
 12. The apparatus according to claim 11, wherein themodules further comprise: a receiving module, configured to receive asubject resource update request comprising a representation of a newsubject resource and a uniform resource identifier of the subjectresource to be updated, wherein the representation of the new subjectresource comprises information about an operation resource associatedwith the new subject resource, and wherein the receiving module updatesthe stored representation of the subject resource to the representationof the new subject resource according to the uniform resource identifierof the subject resource to be updated; or the receiving module,configured to receive an operation resource create request comprisingthe representation of the operation resource associated with the subjectresource and the uniform resource identifier of the operation resourceset to which the operation resource belongs, and the receiving moduleadds the representation of the operation resource to the operationresource set according to the uniform resource identifier of theoperation resource set to which the operation resource belongs.
 13. Theapparatus according to claim 11, wherein the representation of theoperation resource further comprises a type of the operation request andan input parameter of the operation request, wherein the type of theoperation request is create or update; and the construction module isfurther configured to: retrieve, when the input parameter is a uniformresource identifier of a parameter resource, a representation of a newobject resource from the parameter resource that is pointed to by theuniform resource identifier of the parameter resource; and construct theoperation request that comprises the uniform resource identifier of theobject resource and the representation of the new object resource andthat is for the object resource in the representation of the operationresource; or construct, when the input parameter is a representation ofa new object resource, the operation request that comprises the uniformresource identifier of the object resource and the representation of thenew object resource and that is for the object resource in therepresentation of the operation resource.
 14. The apparatus according toclaim 11, wherein: the receiving module is further configured to receivean operation resource update request before the retrieving moduleretrieves the change result of the content of the subject resourcestored in the memory, wherein the operation resource update requestcomprises a representation of a new operation resource, wherein therepresentation of the new operation resource comprises a representationof a dependency resource or a uniform resource identifier of adependency resource, and is configured to update the storedrepresentation of the operation resource to the representation of thenew operation resource; or the receiving module is further configured toreceive a dependency resource create request before the retrievingmodule retrieves the change result of the content of the subjectresource stored in the memory, wherein the dependency resource createrequest comprises a representation of a dependency resource and auniform resource identifier of a dependency resource set to which thedependency resource belongs, and is configured to save therepresentation of the dependency resource to the dependency resource setaccording to the uniform resource identifier of the dependency resourceset to which the dependency resource belongs, and add the uniformresource identifier of the dependency resource set to the representationof the operation resource.
 15. The apparatus according to claim 14,further comprising a determining module, wherein: the retrieving moduleis further configured to: retrieve, according to the representation ofthe operation resource, the representation of the dependency resourceassociated with the operation resource; retrieve a representation of acondition resource that is pointed to by a uniform resource identifierin the representation of the dependency resource; and send therepresentation of the condition resource and a condition in therepresentation of the dependency resource to the determining module; andthe determining module is configured to: receive the representation ofthe condition resource; and determine, according to the representationof the condition resource, that the condition in the representation ofthe dependency resource is met.
 16. The apparatus according to claim 15,wherein types of the dependency resource are classified into asufficient condition type and a necessary condition type, and adependency resource quantity is classified into a sufficient conditiontype, a necessary condition type, or both; and the determining module isfurther configured to determine that a condition specified by at leastone dependency resource of the sufficient condition type is met; or thedetermining module is further configured to determine that conditionsspecified by all dependency resources of the necessary condition typeare met.
 17. The apparatus according to claim 11, wherein therepresentation of the operation resource further comprises an operationexecution result, and the receiving module is further configured toreceive an operation response returned by a device in which the objectresource is located, and save the operation response into the operationexecution result in the representation of the operation resource; or therepresentation of the operation resource further comprises an addressreflecting an operation execution result and the operation executionresult, and the receiving module is further configured to receive anoperation response returned by the device in which the object resourceis located, and the retrieving module is further configured to retrieve,according to the address reflecting the operation execution result, anoperation result corresponding to the operation request, and save theoperation result corresponding to the operation request into theoperation execution result.
 18. An operation triggering apparatus formachine-to-machine communications, comprising: a network interface,configured to perform communication with an external device; a memory,configured to store an application program and store a representation ofa subject resource, wherein the representation of the subject resourcecomprises content of the subject resource and information about anoperation resource associated with the subject resource; and aprocessor, configured to: invoke the application program stored in thememory; retrieve, when the content of the subject resource is changed, achange result of the content of the subject resource stored in thememory; and retrieve, according to the information about the operationresource associated with the subject resource, a representation of theoperation resource associated with the subject resource, wherein therepresentation of the operation resource comprises a condition forsending an operation request to an object resource and a uniformresource identifier of the object resource; and construct the operationrequest for the object resource when it is determined that the changeresult meets the condition for sending the operation request to theobject resource in the representation of the operation resource; whereinthe network interface is further configured to send the operationrequest to the object resource according to the uniform resourceidentifier of the object resource.
 19. The apparatus according to claim18, wherein the representation of the operation resource furthercomprises a type of the operation request and an input parameter of theoperation request, wherein the type of the operation request is createor update; and when the input parameter is a uniform resource identifierof a parameter resource, the processor retrieves a representation of anew object resource from the parameter resource that is pointed to bythe uniform resource identifier of the parameter resource, andconstructs the operation request that comprises the uniform resourceidentifier of the object resource and the representation of the newobject resource and that is for the object resource in therepresentation of the operation resource; or when the input parameter isa representation of a new object resource, the processor constructs theoperation request that comprises the uniform resource identifier of theobject resource and the representation of the new object resource andthat is for the object resource in the representation of the operationresource.
 20. The apparatus according to claim 19, wherein therepresentation of the operation resource further comprises an operationexecution result, the network interface is further configured to receivean operation response returned by the device in which the objectresource is located, and the processor saves the operation response intothe operation execution result in the representation of the operationresource; or the representation of the operation resource furthercomprises an address reflecting an operation execution result and theoperation execution result, the network interface is further configuredto receive an operation response returned by the device in which theobject resource is located, and the processor retrieves, according tothe address reflecting the operation execution result, an operationresult corresponding to the operation request, and saves the operationresult corresponding to the operation request into the operationexecution result.